简体   繁体   中英

301 permanent redirect - all get variables

I have hundreds of pages with different categories. Is it possible to write one RewriteRule for all? I want the 301 redirects to go to one page.

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:

RewriteEngine On

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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