URL Redirection Method in SEO (301, 302 and 307)


There are several reasons to use URL redirection:
  • Moving a old site to new domain
  • URL Shortening
  • Mis-type a URL
  • Search Engine Manipulation ( Canonical )
  • Manipulating visitors
The HTTP standard defines several status codes for redirection methods:
  • 300 – multiple choices redirection
  • 301 – moved permanently
  • 302 – temporary redirect ( used to specify redirection for unspecified reason)
  • 307 – temporary redirect
Redirect using .htaccess :

Redirect to old Domain website to new domain website:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*olddomain\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
———————————————————————————————–————————–
301 Redirection from www to non-www site:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^domain\.com
RewriteRule (.*) http://domain.com/$1 [R=301,L]
———————————————————————————————–————————–
301 Redirection from non-www to www site:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]
———————————————————————————————–————————–
Now Google provides the solutions for canonical issues for adding meta tag,
<link rel=”canonical” href=”http://www.preferreddomain.com”>

Comments are closed.

%d bloggers like this: