301 Redirect – How to Redirect a Website or Web Page and Preserve Your Rankings

301 redirect
Need to redirect your old website to a new one?

Need to redirect an old page to a new page?

Want to transfer the rankings of your old site to your new one?

Want to redirect non www pages to www pages?

These are a few of the questions website owners ask when they redesign their websites and want to preserve their rankings. For instance you have a static html site that’s been redesigned into a Content Management System (CMS) such as WordPress and want to make sure visitors accessing the old pages in the search engines get redirected to the new pages

What is a 301 redirect?

When search engines index your web pages they store them in cache memory (data that is repeatedly required). When you change the URL of your web page or website it still remains in Google’s cache. This means people searching for your site will still see your old website. To prevent this from happening you need to redirect your old web pages to the pages on your new website. This is a achieved through a 301 redirect sometimes called 301 permanent redirect.

Requirements

Filezilla (FTP software)
This is free FTP software you need to transfer files from your desktop to the server. To transfer the files you simply drag files from your local (computer) window to the remote (server) window.

Apache web server
99% of web servers these days use Apache to host websites however check with your web host before implementing a 301 redirect.

.htaccess file
This is the text file containing your 301 redirect code which is uploaded to the root directory of the server (same location as your index.html file). If the .htaccess file is already on the server download it to your desktop then open it with Wordpad or a text editor. Avoid using MS Word…it will mess up the code.

301 redirect code
This is the code to add to your .htacess file to redirect your site or pages to your new site.

How To Set Up A 301 Redirect

Procedure

  • Create a .htacess file in a text editor and save it as .htaccess.txt
  • Add the 301 redirect code and save the file
  • Upload the .htaccess file to the root of the server of your old site
  • Test the redirect works by entering the old URL in your browser
  • It should automatically redirect to your new website

Sidebar:
If you’re redirecting non www pages to www pages upload the .htaccess to the root of the server of your current website (same location as your index.html file).

Examples

1. To 301 redirect your old website to your new website use this code:

redirect 301 / http://www.example.com/

Replace example.com with the URL of your new site. This will redirect traffic from your old site to the index page of your new site. Keep in mind it won’t redirect each page to it’s new page.

2. To 301 redirect a single page use this code:

redirect 301 /oldpage.html http://www.example.com/newpage.html

Replace oldpage.html with the URL of your old page and replace newpage.html with the new page you want to redirect to.

3. To 301 redirect a folder to another folder use this code:

redirect 301 /folder/ http://www.mysite.com/folder/

4. To 301 redirect non www pages to www pages use this code:

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

Replace mysite with your own website URL. Test if the redirect works by entering mysite.com, http://mysite.com in your browser. It should redirect all pages to the www version.

5. To permanently redirect an old domain to new domain use this code:

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

Replace newdomain.com with the URL of your new domain.

6. To redirect .htm pages to .php pages use this code:

RewriteEngine on
RewriteBase /
RewriteRule (.*).htm$ /$1.php

Make sure you have mod_rewrite enabled on your server.

7. To redirect any index.html pages to your home page use this code:

# index.html to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]

You will have multiple home pages if your navigation menu contains multiple index.html pages. This confuses the search engines because they’ll be dividing your traffic between 2 types of home pages e.g. index.html and http://www.yourdomain.com. Use the code above to redirect all index.html pages to the home page. Replace index.html with index.php if your site contains php pages.

Test your 301 redirect works

Type the URL of your old website into your browser address bar. It should immediately redirect to the new website. Also check that your non www pages redirect to www pages. Use this 301 redirect checker to make sure your redirects work successfully.

Tips

  • When redirecting the files of an old domain or website to a new domain or new website maintain the registration and hosting of the old domain. This gives search engines time to index and update the backlinks of your new site. Terminate your old website only when there are no traces of it in the search engines. This will take a few weeks or months.
  • Notify your link partners of the domain name change as soon as possible. After you terminate your old domain any search engine benefits you’ve built up through your old links will be gone unless you’ve implemented the 301 redirect. When obtaining new backlinks make sure they point to your new domain.
  • Avoid using 301 redirects to redirect multiple domain names to your main website. Search engines want to provide a good resource for their visitors when they visit a website.

Related Articles
301 Redirect for Multiple Domains
How to Redirect a Web Page Using a 301 Redirect
301 vs 302 Redirect

***********************
Need help with the Design, Redesign or SEO of your website?
Go to: Website Design Maryland

Comments

  1. I blog often and I really thank you for your content.
    This article has really peaked my interest. I’m going to bookmark your blog and keep checking for new details about once a week. I opted in for your Feed as well.

  2. After I originally left a comment I appear to have clicked on the -Notify me when new comments are added- checkbox and from now on every time a
    comment is added I recieve four emails with the exact same comment.
    Perhaps there is a means you can remove me from that service?
    Cheers!

  3. Thanks for your time for composing “301 Redirect
    – How to Redirect a Website or Web Page”. Iwill absolutely wind up being coming back for a lot more browsing and
    writing comments soon. Thanks a lot, Tuyet

Trackbacks

  1. […] Articles How to Redirect a Website or Web Page and Preserve Your Rankings 301 Redirect for Multiple Domains How to Redirect a Web Page Using a 301 Redirect 301 Redirect PHP […]

  2. […] To implement a 301 redirect for all the above scenarios read How to redirect a website or web page and preserve your rankings […]

  3. […] Articles How to Redirect a Website or Web Page and Preserve Your Rankings 301 Redirect for Multiple Domains How to Redirect a Web Page Using a 301 Redirect 301 vs 302 […]

Speak Your Mind

*