I'm trying to set up a site that forwards everything but the root directory and index into a variable. I have the htaccess file set up like this right now:
Options +FollowSymlinks
RewriteEngine on
RewriteRule -(.*)$ http://blah.com/blah.php?name=$1 [R,NC]
just so that the index works and anything that starts with a hyphen(-) is rewritten
I would like to be able to have anything that isn't the i开发者_Python百科ndex file rewritten, and still allow the index file be accessed via blah.com and blah.com/
Any ideas?
Try this :
RewriteCond %{REQUEST_URI} !^/index.php$
RewriteCond %{REQUEST_URI} !^/blah.php
RewriteCond %{REQUEST_URI} !^$
RewriteRule ^(.*) http://blah.com/blah.php?name=$1 [R,NC]
If by any chance you still haven't figured this out, this should work:
RewriteCond %{REQUEST_URI} !^(/|/index.php|/blah.php)$
RewriteRule ^(.*)$ blah.php?name=$1 [R]
精彩评论