简体   繁体   English

在.htaccess中的网址重写中向网址添加问号

[英]adding a question mark to the url in url rewrite in .htaccess

Hi everybody i am trying to append a question mark at the end of my file name in url rewrite, after which will be my url parameters, like example the expected url is like: 大家好,我想在网址重写中在文件名的末尾添加一个问号,此后将是我的网址参数,例如示例,预期的网址如下:

http://localhost/project/pass/?something@gmail.com-3861

and the rule that i am using is below: 我正在使用的规则如下:

RewriteRule ^pass/?(\w.+)-(\w.+)$   view/pass.php?useremail=$1&actcode=$2 [L]

but the ? 但是? is not working as i assuming it to be a reserved keyword. 不工作,因为我假设它是保留关键字。 If i use some other things like - then they work 如果我使用其他类似的东西-那么它们会起作用

Can anyone tell me solution to that so that i can use ? 谁能告诉我解决方案,以便我可以使用? in my url rewrite? 在我的网址重写?

RewriteRule does not accept query. RewriteRule不接受查询。 Use RewriteCond 使用RewriteCond

RewriteEngine on
RewriteCond %{QUERY_STRING} (\w.+)-(\w.+) 
RewriteRule ^pass/$   view/pass.php?useremail=%1&actcode=%2 [L]

如果要使用不带保留字符功能的保留字符( ?代表“零次或一次”),请在其前添加反斜杠\\

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM