Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 重定向查询字符串_.htaccess_Mod Rewrite - Fatal编程技术网

.htaccess 重定向查询字符串

.htaccess 重定向查询字符串,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我正在尝试重定向,但它不起作用 我想重定向: http://www.example.com/page/168?s 致: 使用 您需要QSA(查询字符串追加): 否则,重写不包括问号后面的部分。我找到了解决方案: RewriteCond %{QUERY_STRING} ^s$ RewriteRule ^(.*)$ http://www.example.com/$1? [R=301,L] 万一有人需要 谢谢你谢谢你的回答。没用。日志没有显示任何错误,但不会重定向。问号后的“s”未

我正在尝试重定向,但它不起作用

我想重定向:

http://www.example.com/page/168?s  
致:

使用

您需要QSA(查询字符串追加):


否则,重写不包括问号后面的部分。

我找到了解决方案:

RewriteCond %{QUERY_STRING} ^s$  
RewriteRule ^(.*)$ http://www.example.com/$1? [R=301,L]    
万一有人需要


谢谢你

谢谢你的回答。没用。日志没有显示任何错误,但不会重定向。问号后的“s”未被排除。
RewriteCond %{QUERY_STRING} ^q=s$  
RewriteRule ^(.*)$ http://www.example.com/$1? [R=301,L]
Using RewriteCond %{QUERY_STRING} ^q=s$
RewriteRule ^(.*)$ http://www.example.com/$1? [R=301,L,QSA]
RewriteCond %{QUERY_STRING} ^s$  
RewriteRule ^(.*)$ http://www.example.com/$1? [R=301,L]