.htaccess Question mark allowing

可紊 提交于 2019-12-07 20:30:01

问题


Hello today i tried to rewrite few things, i tried to rewrite this:

www.example.com/index.php?title=how+do+man+live?

To:

www.example.com/posts/how+do+man+live?/

Now the problem is that the question mark appears only at url and when i post the $_GET variable(title..) its post everything but not the question mark.

i tried put in rewrite mdoe this:

RewriteRule post/([0-9א-בa-zA-Z+.`?]+)/?$ index.php?title=$1 [NC]

course that the Rewrite engine is on. thank you guys, have wonderful day!


回答1:


You need to capture this value from THE_REQUEST variable to be able to capture ? also. Use this rule in root .htaccess:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+posts/(\S+) [NC]
RewriteRule ^ index.php?title=%1 [L,QSA]


来源:https://stackoverflow.com/questions/26433965/htaccess-question-mark-allowing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!