Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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/5.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
Apache 重定向除?p之外的所有内容=*_Apache_.htaccess_Mod Rewrite_Redirect_Seo - Fatal编程技术网

Apache 重定向除?p之外的所有内容=*

Apache 重定向除?p之外的所有内容=*,apache,.htaccess,mod-rewrite,redirect,seo,Apache,.htaccess,Mod Rewrite,Redirect,Seo,如何配置.htaccess文件以重定向除 domain.com?p=* 及 到domain.com 我希望你能理解我的问题,谢谢你的每一个回答。 来自德国的问候语。将其放入文档根目录的htaccess文件中: RewriteEngine On # if query string is p=(something) RewriteCond %{QUERY_STRING} ^p= # and request is for "/" or "/index.php" RewriteCond %{REQU

如何配置.htaccess文件以重定向除

domain.com?p=*

到domain.com

我希望你能理解我的问题,谢谢你的每一个回答。
来自德国的问候语。

将其放入文档根目录的htaccess文件中:

RewriteEngine On

# if query string is p=(something)
RewriteCond %{QUERY_STRING} ^p=
# and request is for "/" or "/index.php"
RewriteCond %{REQUEST_URI} ^/$ [OR]
RewriteCond %{REQUEST_URI} ^/index\.php$
# pass it through, don't do anything
RewriteRule ^ - [L]

# otherwise, redirect everything else to http://domain.com/
RewriteRule ^ http://domain.com/ [L,R=301]
RewriteEngine On

# if query string is p=(something)
RewriteCond %{QUERY_STRING} ^p=
# and request is for "/" or "/index.php"
RewriteCond %{REQUEST_URI} ^/$ [OR]
RewriteCond %{REQUEST_URI} ^/index\.php$
# pass it through, don't do anything
RewriteRule ^ - [L]

# otherwise, redirect everything else to http://domain.com/
RewriteRule ^ http://domain.com/ [L,R=301]