1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

The redirect 301 tutorial is a direct jump right into the world of .htaccess files. The 301 error is a redirect error that tells the search engines that a page or site has permanently moved to a new location. So the idea is if you have a site and/or pages, listed in Google, this well tell Google where that site and/or page has moved to. Shortly your new URLs should update in Googles listing.

Creating redirect 301 lines in your .htaccess file is easier than you may think. First, create your .htaccess file. (htaccess guide) Read through the examples below and see which type of redirect you need. After you choose either a domain or page redirect example upload the .htaccess file in the root www directory of your domain.

Many webmasters use Scripts, META refresh, or JavaScript to forward traffic and search bots to a new page. Doing this may make the search engines think you are spamming. The safest way to redirect your traffic, and the bots, is using an .htaccess file with the commands below

1) This example redirects an old page to a new url.
redirect 301 /blog/index.php http://www.domain.com/archive/index.php
redirect 301 /blog/login.php http://www.domain.com/archive/login.php
redirect 301 /contact.html http://www.domain.com/support.php

Broken Down:
redirect 301
(/web path to old file) http://www.new-location.com/whatever-it-is.php
The key here is to make sure the path always starts with the "/" and ends with a file name.

2) This example redirects your old domain to your new domain:
redirect 301 / http://www.new-domain.com/ The "/" after the 301, will redirect everything from the top level of the domain. As long as the "new site" is an EXACT copy of the "old site" (every file, directory, image), then this is a quick and simple way to move an old site to a new home.Make sure you add the ending slash "/" at the end of your new-domain.com url. And don't forget to include the http://

3) More Advanced Examples:
a) Other old page to new page redirects:
redirect permanent /blog/index.php http://www.new-blog-domain.dom/
redirectpermanent /blog/login.php http://www.new-blog-domain.com/login.php

b) Other old domain to new domain redirects:
redirectMatch 301 ^(.*)$ http://www.new-blog-domain.com
redirectMatch permanent ^(.*)$ http://www.new-blog-domain.com

c) Redirecting old name.PHP named files to new same-name.HTML files.
RedirectMatch (.*)\.php$ http://www.same-domain.com$1.html

The examples can keep going. As luck would have it, the syntax used on some of the examples may need to tweeked a little for your Apache web server settings. But, not to worry, I have listed a few sites that I thought provided good extended examples and information on using 301 redirects and related commands.

Best of luck with your 301 redirects and don't forget to test your work.
~ TheDoc


.: Visitor Services :.