this is my file structure at the web server:
DOCUMENT_ROOT/
foo/
www/
.htaccess
bar/
index.php
What i should write to foo/.htaccess
, if I want to redirect everything from www.myserver.com/foo/www/
to www.myserver.com/foo/
?
I tried this:
RewriteEngine On
RewriteRule ^(.*)$ /www/$1 [L,NE]
But error 404 is always shown. I tried elaborate with RewriteBase also with no success.
Thanks a lot
P.S. When www/
and .htaccess
is in DOCUMENT_ROOT, it works OK. But when I put them to subfolder, always getting error 404 :-(
Yes, I want to go to
http://www.myserver.com/foo/
and get served the stuff in/foo/www
This will never work if your htaccess file is in /foo/www
because it won't take effect unless the request is for something inside /foo/www
. The request is only /foo
so the .htaccess
file is ignored. You'll need to either move the .htaccess
file to the document root, changing it to:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/foo/www
RewriteRule ^foo/(.*)$ /foo/www/$1 [L]
or move it to the /foo
directory, changing it to:
RewriteEngine On
RewriteBase /foo
RewriteCond %{REQUEST_URI} !^/foo/www
RewriteRule ^(.*)$ www/$1 [L]