简体   繁体   English

301永久重定向 - 所有获取变量

[英]301 permanent redirect - all get variables

I have hundreds of pages with different categories. 我有数百页不同的类别。 Is it possible to write one RewriteRule for all? 是否可以为所有人编写一个RewriteRule? I want the 301 redirects to go to one page. 我希望301重定向转到一页。

Example pages: 示例页面:

forms-category.html?category=trusts
forms-category.html?category=loans
etc..

All to redirect permanently to one page: 全部永久重定向到一个页面:

RewriteRule ^forms-category.html?(?:.*)$    final.html  [L,NS,R=301]

You can use this rule in your root .htaccess: 您可以在根目录中使用此规则.htaccess:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^category=[^&]+
RewriteRule ^forms-category\.html$ /final.html? [L,NC,R=301]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM