Posted By

nielsenrc on 02/17/11


Tagged

htaccess


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

depiction


301 Redirect for Query Strings


 / Published in: Apache
 

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

  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  

You need to login to post a comment.