Apache URL 使用查询字符串重写为 ajax url
Apache URL rewrite to ajax url with query string
我有一个URL重写的要求,下面是例子URL并且ajax调用会调用点击事件
来自
https://www.test.com/load/research/compare?submit=true&Actions=ajax&componentID=1600176192830&alias=test-with-machine&subFeature=%2Ftemplate%2Fcontent%2Fmedia
到
https://www.test.com/learn/research/detail?submit=true&Actions=ajax&componentID=1600176192830&alias=test-with-machine&subFeature=%2Ftemplate%2Fcontent%2Fmedia
我尝试了多种方法来处理这个问题,但都失败了,下面是 VHOST 条目
#RewriteCond %{QUERY_STRING} ^(.*)submit=true(.*)$
#RewriteCond %{QUERY_STRING} (^|&)submit=([^&]*)(&|$)
#RewriteCond %{QUERY_STRING} ^(.*&)?submit=true?(&|$) [NC]
RewriteCond %{QUERY_STRING} !^$
RewriteRule ^/load/research/^(.*)/$ http://localhost:8080/learn/research/detail? [QSA]
如有任何帮助,我们将不胜感激。谢谢
以下URL重写工作正常
RewriteCond %{QUERY_STRING} ^(.*&)?submit=true?(&.*)?$ [NC]
RewriteRule ^/load/research/(.*)$ http://localhost:8080/learn/research/detail?submit=true%1%2 [P,L]
我有一个URL重写的要求,下面是例子URL并且ajax调用会调用点击事件
来自
https://www.test.com/load/research/compare?submit=true&Actions=ajax&componentID=1600176192830&alias=test-with-machine&subFeature=%2Ftemplate%2Fcontent%2Fmedia
到
https://www.test.com/learn/research/detail?submit=true&Actions=ajax&componentID=1600176192830&alias=test-with-machine&subFeature=%2Ftemplate%2Fcontent%2Fmedia
我尝试了多种方法来处理这个问题,但都失败了,下面是 VHOST 条目
#RewriteCond %{QUERY_STRING} ^(.*)submit=true(.*)$
#RewriteCond %{QUERY_STRING} (^|&)submit=([^&]*)(&|$)
#RewriteCond %{QUERY_STRING} ^(.*&)?submit=true?(&|$) [NC]
RewriteCond %{QUERY_STRING} !^$
RewriteRule ^/load/research/^(.*)/$ http://localhost:8080/learn/research/detail? [QSA]
如有任何帮助,我们将不胜感激。谢谢
以下URL重写工作正常
RewriteCond %{QUERY_STRING} ^(.*&)?submit=true?(&.*)?$ [NC]
RewriteRule ^/load/research/(.*)$ http://localhost:8080/learn/research/detail?submit=true%1%2 [P,L]