Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.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/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
Php 如何重定向301错误url?_Php_.htaccess - Fatal编程技术网

Php 如何重定向301错误url?

Php 如何重定向301错误url?,php,.htaccess,Php,.htaccess,我的url不正确: http://mypage.org/first/second/?one=two&three=3&44=1 我想把这个重定向到: http://mypage.org 但在htaccess中: Redirect 301 /first/second/?one=two&three=3&44=1 http://mypage.org 不工作。例如: Redirect 301 /first/second http://mypage.org 工作正常。

我的url不正确:

http://mypage.org/first/second/?one=two&three=3&44=1
我想把这个重定向到:

http://mypage.org
但在htaccess中:

Redirect 301 /first/second/?one=two&three=3&44=1 http://mypage.org
不工作。例如:

Redirect 301 /first/second http://mypage.org

工作正常。

您可以使用
mod\u rewrite

RewriteEngine On

RewriteCond %{QUERY_STRING} ^one=two&three=3&44=1$ [NC]
RewriteRule ^first/second/$ /? [R=301,L]