How to create a 301 redirect

There are many ways to redirect site visitors from one page to another. However there are very few ways that are considered proper and recommended by the Search Engines.

The 301 Redirect

By far, the most Search Engine Friendly way to redirect from one page to another is the 301 redirect. The 301 redirect, initially can look a bit like a two headed monster to even a web designer, let alone an average website owner. But once you figure it out, it is both simple to implement and in and had the added benefit of passing along the old page’s rankings to the new page (Note other changes from the old to new page may affect your rankings in the (SERPs).

What does it mean?
301 notifies browsers and search engine spiders that the page they are trying to get has been permanently movied.

When do I use it?
Anytime that you need to change the file name of a web page, change the extension (eg. from .html to .php), or change the location of a page on your website.

There are a few ways to implement a ’301′ redirect for your page(s). The most accepted method is to redirect from your server: If you use an Apache web server then you would use the .htaccess method, Window’s servers use the IIS redirect method. It’s not always possible to have access to these methods, if you do not then you can also redirect using PHP or ASP.

Here’s how to do it:

.htaccess redirect

  • Create a text file (notepad is recommended) save it as .htaccess
  • In the .htaccess file put the following code:
    redirect 301 /pathto/oldpage.ext http://www.domain.com/newpage.ext
  • Save the file
  • upload the .htaccess file to the directory the file you are redirecting is in or the root directory of your website
  • Done – Check to make sure it works

IIS redirect

  • In your IIS manager, right click on the file or directory that you want to redirect
  • Select the radio button ‘a redirection to a URL’
  • Enter the URL of the new page
  • Make sure that both ‘The exact url entered above’ and ‘A permanent redirection for this resource’ are selected
  • Click on ‘Apply’
  • Done – test to make sure it works

PHP redirect

  • Place the following code into the web page you wish to redirect:
    < ?
    Header( "HTTP/1.1 301 Moved Permanently" );
    Header( "Location: http://www.domain.com/pathto/newpage.ext" );
    ?>
  • Done – test to make sure it works

ASP .NET redirect

  • Place the following code into the web page you wish to redirect:
  • Done – test to make sure it works

6 Comments

  1. sushirose
    Posted 4 May, 2008 at 10:50 pm | Permalink

    Hi Ron,

    I read your response on WebProWorld – “Re: 301 redirect vs. DNS change”. I need to know the correct direction for a 301 redirect.

    new-domain.com –> old-domain.com
    or
    old-domain.com –> new-domain.com

    The dilemma I have here is how to perform the 301 redirects of all IBL’s.

    Thanks.

  2. Posted 4 May, 2008 at 11:02 pm | Permalink

    Hi sushirose! Thanks for asking…
    ASP.net and PHP redirects are done in the code on the old page pointing to the new page…
    .htaccess uses the following code:
    redirect 301 /pathto/oldpage.ext http://www.domain.com/newpage.ext

    so that is old-domain.com –> new-domain.com

    Once you have set up redirects for each page on your website (old -> new) then any IBLs will still be pointing to the old page but due to the 301 redirect will automatically redirect the visitor to the new URL.

    The BIG job in all this (until someone figures out a way to do it automatically) is that you actually need to contact each and every IBL that’s out there pointing to your website, notify them that the URL has been changed and request that they update their link to your site… Start with the most important IBLs (if you’re able).

    Best of luck!

  3. sushirose
    Posted 5 May, 2008 at 12:18 am | Permalink

    Thanks Ron for the info.

    Just so I understand correctly, when I type the following:

    old-domain.com/about.htm – I will be redirected to new-domain.com/about.htm

    new-domain.com/about.htm – I will simply get the page I requested on new-domain.com/about.htm

    Now what if the new-domain.com is registered elsewhere? Should I have it migrated to the Web hosting company? The Web hosting company suggested adding old-domain.com’s virtual IP address to the “A record” of new-domain.com then updating the old-domain.com host headers. Then finally doing the 301 redirect for all Web pages.

    I’m not a server engineer so this is my understanding.

    Please advise.

    Thanks.

  4. Posted 5 May, 2008 at 12:36 am | Permalink

    No problem Rose,

    You don’t have to move the site or touch the DNS..

    Just 301 redirect each page and they will go to the new pages on the new site… that’s why the second part of the 301 redirect requires the complete URL of the new page.
    Hope that helps.

  5. sushirose
    Posted 7 May, 2008 at 11:59 am | Permalink

    Hi Ron…

    I get the old –> new and I found a great tool to check the type of redirect setup – http://www.internetofficer.com/seo-tool/redirect-check/

    In your response you said, “Once you have set up redirects for each page on your website (old -> new) then any IBLs will still be pointing to the old page but due to the 301 redirect will automatically redirect the visitor to the new URL.”

    There are no physical files related to the new domain. The redirect is a virtual redirect. Once all the IBL’s are recognized with the new domain name, should I migrate permanently or will the 301 redirect suffice? Are there any benefits to migrating?

    Gracias…

  6. Posted 7 May, 2008 at 2:05 pm | Permalink

    HI Rose,

    The 301 should be pointing to a physical file on the new domain.
    After all inbound links and search engines are linking to the new domain yes you could just turn the old domain into a forward from the registrant and drop the hosting on it.

One Trackback

  1. [...] many times from others (especially when I was teaching) so I took my notes and put together a post on my blog that gives you windows and apache options server and browser side 301 redirects: Hope some find [...]

Post a Comment

Your email is never shared. Required fields are marked *

*
*