Check out the Latest Articles:

301_redirHi..

Today I will be dealing with a serious topic that is Redirecting pages using 301 Redirect

You might be wondering why I did that 301 Redirect bold and in red color. Its because that’s the point where we need to focus upon. There come times when we need to redirect our traffic to different page either when changing the domain or any such reason. There come the point how to let the traffic from search engines flow smoothly without any disturbance. And there comes the need of redirecting properly. Ad to do the honours we need to redirect via 301 redirect method. 301 redirect can be done in many ways and its quite simple to do it without much efforts.

Why 301 Redirect ?

301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It’s not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it’s the safest option. The code “301″ is interpreted as “moved permanently”.

How to 301 Redirect ?

I’ll be showing you 2 ways to do this, one is by a simple PHP File and the other one using the .htaccess file

PHP Redirect

Just add this code to your current php file on the top, the “http://www.new-url.com” is the URL of the page where you want the current page to redirect it to…

<? Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>

Using the .htaccess file there are a couple of things you can play with to redirect specigic or all pages in a directory or a complete website..

Redirect Old domain to New domain

Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

Please REPLACE www.newdomain.com in the above code with your actual domain name.

Redirect to www (htaccess redirect)

Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

Please REPLACE domain.com and www.newdomain.com with your actual domain name.

Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

You can Test your redirection with Search Engine Friendly Redirect Checker

Related posts:

  1. MS DOS Tutorials – How to Create, Delete, Change, Rename Directory and Files
  2. Height of SEO !! What the Heck is Google Algorithm ?
  3. Serious Security Issues with Google Chrome Exploit
  4. The Anatomy Of StumbleUpon – How to drive more traffic with StumbleUpon
  5. How to Create Post Accordions in WordPress


  1. It‘s quite in here! Why not leave a response?