[英]htaccess 301 redirect — remove a string
I am trying to do this htaccess 301 redirect, but I am stuck. 我正在尝试执行htaccess 301重定向,但是我被卡住了。
What I want is to remove a string in the URL, the string is: style=5& 我想要的是在URL中删除一个字符串,该字符串为: style = 5&
I want the redirect it so all pages that may get that string in the URL will be removed. 我想要重定向它,以便所有可能在URL中获得该字符串的页面都将被删除。 -- Thanks in advance.
- 提前致谢。
FROM: 从:
/viewtopic.php?style=5&f=45&t=1980&p=19136
TO: 至:
/viewtopic.php?f=45&t=1980&p=19136
You can use this code in your DOCUMENT_ROOT/.htaccess
file: 您可以在
DOCUMENT_ROOT/.htaccess
文件中使用以下代码:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.+?&)?style=5(?:&(.*))?$ [NC]
RewriteRule ^viewtopic\.php$ %{REQUEST_URI}?%1%2 [R=302,NC,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.