I have the folowing structure:www.example.com - DE version www.example.com/de - DE version www.example.com/en - EN versionI want to be like that:www.example.com - DE versionwww.example.com/de ---> Redirect 301 to www.site.comwww.example.com/en - EN versionThat's my current htaccess:RewriteEngine onRewriteCond %{HTTP_HOST} !^www\.RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]I have tried examples but no success.Any ideas?
Redirect a subdirectory to the main domain in htaccess
htaccess;mod rewrite
To redirect example.com/de to example.com (and all the URLs within) then you can do something like the following (after your current directives):RewriteRule ^(?:de|de/(.*))$ /$1 [R=301,L]This will redirect /de or /de/ or /de/something to the corresponding URL in the document root. It won't redirect /desomething (in case you have other files in the root that start de).The ?: after the first parenthesis makes the group non-capturing.To prevent /de/ (trailing slash) from redirecting you could change the * (0 or more) to + (1 or more) in the regex. ie. ^(?:de|de/(.+))$