I have a php/apache website under my userdir, say http://localhost/~johnny5/
I have a /en
folder with a .htaccess
file and a index.php
file :
/home/johnny5/public_html
/somefile.php
/someotherfile.php
/en/
.htacces
index.php
I enable url rewriting under /en
so all the request are handled by index.php. here's the content of .htacces :
Options +FollowSymLinks
RewriteEngine On
RewriteBase /~johnny5/en
RewriteRule . index.php
Up to here, everything works correctly.
When I hit, say, http://localhost/~johnny5/en/foo/bar
, the request is handled by /en/index.php
.
Now, for testing purpose, I move the site under /var/www
so I can acces it directly by http://localhost/
. I adjust the .htaccess
file to remove the user folder:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /en
RewriteRule . index.php
I now have this structure:
/var/www
/somefile.php
/someotherfile.php
/en/
.htacces
index.php
Now, if I hit http://localhost/en/foo/bar
, I'd expect the request to be handled by /en/index.php
, but all I got is a 404 not found for /en/foo/bar
.
It looks like the rewrite module works under my user dir, but not under the "main" dir.
I am missing something?
So that was all my error - misconfiguration.
I "AllowedOverride" under the wrong folder.
Not sure about your new structure on server, but remember one very important ruler: .htaccess rules works for CURRENT and CHILD (recursivly) directories only, not for dirs which are higher then .htaccess dir.
So if your .htaccess is now in:
it can't work with path
if your http://localhost/ root on server is home/
Try to move your htaccess to the root dir of your www server and try again