0

如何配置 .htaccess 文件以重定向每个链接,除了

domain.com?p=*

domain.com/index.php?p=*

到 domain.com

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

4

1 回答 1

0

将其放入文档根目录的 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]
于 2012-09-12T20:02:57.600 回答