RewriteRule into sub directories is failing
Basically, this works (http://example.com/@user):
RewriteRule ^@([a-zA-Z0-9]+)[/]*$ find.php?twitter=$1 [QSA,开发者_Python百科L]
and this (http://example.com/api/@user):
RewriteRule ^api/@([a-zA-Z0-9]+)[/]*$ twitter.php?username=$1 [QSA,L]
does not. I'm not sure why, but it seems whenever I try to do this, it redirects to http://example.com/@user's function if that makes sense. Basically, the rewrite rule is ignoring the "api/" prefix.
I've tried the following syntax on a test server, and it worked perfectly find. In if doesn't works for you, the problem is probably not with the regex…
RewriteEngine on
RewriteRule ^api/@([a-zA-Z0-9]+)/?$ twitter.php?username=$1 [QSA,L]
RewriteRule ^@([a-zA-Z0-9]+)/?$ find.php?twitter=$1 [QSA,L]
精彩评论