开发者

RewriteRule into sub directories is failing

开发者 https://www.devze.com 2023-03-05 23:54 出处:网络
Basically, this works (http://example.com/@user): RewriteRule ^@([a-zA-Z0-9]+)[/]*$ find.php?twitter=$1 [QSA,开发者_Python百科L]

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]
0

精彩评论

暂无评论...
验证码 换一张
取 消