[英]Mod_rewrite rule not passing PHP variables
I am trying to rewrite the URL (using mod_rewrite) as requested by the user: 我试图按照用户要求重写URL(使用mod_rewrite):
http://example.com/question/1/
To load this URL from the server: 要从服务器加载此URL:
http://www.example.com/question.php?qid=1
I am currently using the rewrite rule: 我目前正在使用重写规则:
RewriteEngine On
RewriteRule ^question/([^/\.]+)/?$ question.php?qid=$1 [L]
But this does not work. 但这是行不通的。 I have tried other things in the .htaccess (such as redirects) and this work, so I know that the .htaccess is being processed. 我已经尝试了.htaccess中的其他操作(例如重定向)和这项工作,所以我知道.htaccess正在被处理。
Thank you. 谢谢。
根据您的示例,您的重写规则应类似于:
RewriteRule ^question/(\d+)/?$ /question.php?qid=$1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.