[英]How to 301 redirect URL with PHP parameters to root DIR in .htaccess?
我已经搜索了如何将参数重定向到根目录,但我无法让它工作:(
这就是.htaccess代码的样子:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
RewriteEngine On
RewriteCond %{QUERY_STRING} id=1
RewriteRule ^phpnuke/modules\.php$ /? [L,R=301]
我有网址,如“ http://www.domain.com/phpnuke/modules.php?name=News&file=article&sid=60 ”,我想将其重定向到“ http://www.diagonally.org/ ”
尝试这样的事情
# For sites running on a port other than 80
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{SERVER_PORT} !^80$
RewriteRule ^/(.*) http://www.example.com:%{SERVER_PORT}/$1 [L,R]
在默认WP重写规则之前保留重定向规则并匹配正确的查询字符串:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} name=News&file=article&sid=60
RewriteRule ^phpnuke/modules\.php$ /? [L,R=301]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.