我想写一个htaccess的规则,将重定向有人要求
I'm trying to write a .htaccess rule that would redirect someone asking for
http://mysite.com/questions/123/my-question-name
到
http://mysite.com/questions/question_handler.php?qid=123
这是我写的,到目前为止(它不工作):
Here's what i wrote so far (it's not working):
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?(.*)$ [NC]
RewriteRule ^(.*)/questions/(d+)/(.*)$ http://%1/questions/question_handler.php?qid=%2$1 [R=301,L]
任何帮助是非常AP preciated。
Any help is much appreciated.
重写规则^ HTTP://([^ /] *)/问题/( d +)/(。*)$ HTTP :?//$1/questions/question_handler.php QID = $ 2
您(。*)
可能是太贪婪所以它使用的 http://mysite.com/questions/123/my-question-name 作为匹配的第一组
Your (.*)
was probably too greedy so it was using http://mysite.com/questions/123/my-question-name as the first group matched