301 Redirect for Query Strings


/ Published in: Apache
Save to your folder(s)

Key for code below:

querystring = just the query string. (e.g. url=page)
index = the page that the query string is appended to (e.g. index.php)
domain.com = the domain and page you want to rewrite to


Copy this code and paste it in your HTML
  1. RewriteCond %{QUERY_STRING} ^querystring$
  2. RewriteRule ^index\.php$ http://www.domain.com/page.html? [R=301,L]
  3.  
  4. //EXAMPLE
  5.  
  6.  
  7. RewriteCond %{QUERY_STRING} ^url=page1$
  8. RewriteRule ^content\.php$ http://www.domain.com/index.html? [R=301,L]

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.