Apache Mod_Rewrite Help
I'm trying to convert a subdirectory to a variable for use in a query.
e.g.
domain/subdir/STRING (Need the "STRING" subdir)
converted to:
domain/subdir/index.php?q=STRING
All I'm getting are Internal Server Errors and 404's and the phpinfo() for some odd reason.
P.S.
Tried the info on this page already: http://corz.org/serv/tricks/htaccess2.php
EDIT:
This appears to be working. RewriteRule ^([a-zA-Z0-9]+)$ index.php?qst=$1
But it limits the match to AlphaNum characters and I would like to in开发者_StackOverflow中文版lcude, -, _ and the # if it's possible.
RewriteRule ^subdir/index\.php(.*) - [L]
RewriteRule ^subdir/(.*)$ /subdir/index.php?q=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^subdir/(.*)$ /subdir/index.php?q=$1
The RewriteCond
checks if the requested document isn't an existing file, that way we don't get a recursive call for index.php
The next rule is a common rewrite to request /subdir/index.php
.
精彩评论