Tuesday, March 15, 2011

Canonical Issue and 301 resirection

RewriteEngine on
RewriteBase /

//code to redirect nonwww version of the site to www site version
RewriteCond %{http_host} ^abc\.com [NC]
RewriteRule ^(.*)$ http://www.abc.com/index.php [R=301,NC]


//code to redirect www version of the site to nonwww site version
RewriteCond %{http_host} ^www.abc\.com [NC]
RewriteRule ^(.*)$ http://abc.com/ [R=301,NC]


//code to redirect index page to home page of the site
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://www.abc.com/ [R=301,L]


//code to redirect internal pages of the sie to another internal page of site
Redirect 301 /faq.php http://www.abc.com/
Redirect 301 /specials.php http://www.abc.com/

1 comment:

  1. RewriteEngine on
    RewriteCond %{http_host} ^holyamarnathyatra.com
    RewriteRule (.*) http://www.holyamarnathyatra.com/$1 [R=301,L]

    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://www.holyamarnathyatra.com/ [R=301,L]

    ReplyDelete