I want to make
www.example.com/test/ rewrite to www.example.com/example.com/test/
www.example.com/ rewrite to www.example.com/example.com/
I can do that with this rewrite configuration:
RewriteCond %{HTTP_HOST} ^(www\.)?example.com$
RewriteCond %{REQUEST_URI} !^/example.com(.*)
RewriteCond %{REQUEST_URI} ^(.*)/$
RewriteRule ^(.*) /example.com/$1 [L]
But I also want to redirect the same without trailing slash:
www.example.com/test redirect to www.example.com/example.com/test/
www.example.com/ redirect to www.example.com/example.com/
I have tried with this:
RewriteCond %{HTTP_HOST} ^(www\.)?example.com$
RewriteCond %{REQUEST_URI} !^/example.com(.*)
RewriteCond %{REQUEST_URI} !^(.*)/$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ $1/ [R=301,L]
but does not work, it redirects to:
IE: http://www.example.com/C:/wamp/www/test/
Firefox: http://www.example.com/C:/wamp/www/example.com/test/
do you know a solution to this (without touching mod-dir conf)?
Best Answer
I've found the solution:
Thanks for your answers.