Im trying to produce a rewrite rule to another directory, but unfortunatly it is not working.

My current rewrite transmits everything to the index.php file unless of course the very first word within the query string is admin. The rewrite rule for 'admin' would be to admin.php, however i really would like it to visit /var/www/html/ (rather than the file within the same directory).

This really is current .htaccess file.

RewriteEngine On
RewriteRule ^(.*\/?).*(css|images|js/)+.*$ - [L]
RewriteRule ^\/?admin\/?(.*)$ admin.php?url=$1 [QSA,L]

RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

Basically alter the rewrite rule for admin to utilize a different directory..

RewriteRule ^\/?admin\/?(.*)$ /var/www/html/$1 [QSA,L]

It breaks the website. Any ideas?


It's really fairly simple, you are while using system path, while web path is required.

Try the next line:

RewriteRule ^\/?admin\/?(.*)$ /subfolder/admin.php?url=$1 [QSA,L]

Try these rules:

RewriteRule ^admin($|/(.*)) admin/admin.php?url=$2 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php?url=$0 [QSA,L]