简体   繁体   English

.htaccess重写带有附加问号“?”的URL

[英].htaccess rewrite URL with additional question mark “?”

With .htaccess i can't get working such link: 使用.htaccess,我无法使用这样的链接:

/quiz/results/solution-one/?email=myemail@domain.com

into 进入

/results.php?level=4&email=myemail@domain.com

(solution-one should turn into level=4) (解决方案一应变为4级)

I have spend a few hours building .htaccess code: 我花了几个小时来构建.htaccess代码:

Rewriterule  ^quiz\/results\/solution-one/(.*)/?$ /var/www/domain.com/public_html/results.php?level=4$1 [QSA,L]

Or this one: 或者这个:

Rewriterule  ^quiz\/results\/solution-one/([=@.a-zA-Z-]*) /var/www/domain.com/public_html/results.php?level=4&$1 [QSA,L]

But it doesn't work. 但这是行不通的。

Thanks in advance! 提前致谢!

Try with: 尝试:

RewriteEngine on
Rewriterule  ^quiz/results/solution-one/?$ results.php?level=4 [NC,QSA,L]

Without file path, but relative to root. 没有文件路径,但相对于根目录。 And without test for query string (not part of Rewriterule test uri) 并且无需测试查询字符串(不属于Rewriterule测试uri)

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

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