1. Computing

Discuss in my forum

What is a 301 Redirect?

Changing Your URL Without Penalizing Your Search Engine Optimization

By

A 301 redirect is an HTTP code that is sent by the web server to say that the page has been redirected. The server then sends the browser to the new URL—redirecting it.

301 Means “Moved Permanently”

In the language of HTTP the status code 301 means that the page requested has been permanently moved to a new location. This code encourages clients accessing the URL to change their database to the new location, as the page will never return at the requested location.

This status is important to understand, as it is different than what a meta refresh tells the browser or client accessing the page. The meta refresh says nothing about the permanence of the move, or even provides information in a form that the client can use. In fact, meta refresh was originally intended to reload or “refresh” the current page—not send the client to a new page. It was created so that applications that changed periodically could be updated without the client or reader doing anything.

301 Redirects Are Much Better than Meta Refresh Redirects

The biggest reason why it’s a bad idea to rely on meta refresh tags to redirect your customers is because spammers use them to fool search engines. The spammer sets up a site with lots of keywords—it may even look like a real website. Then they put a meta refresh on the page, so that after a second or two you are redirected to the “real” page. One of the most annoying ones I see all the time has a bunch of web hosting information on it, but the only thing you really have time to read are the words “what is the best hosting company?” or something like that. Then you’re redirected to the host. I assume they’re hoping it will act as a style of “subliminal” advertising, and you’ll think their site is the best hosting. Personally, I just find them sleezy.

Of course, the minute that most reputable search engines find that spammer, they remove the links from their database. And one way they find them is by looking for “meta refresh” tags. So if you use meta refresh tags a lot, you might look like a spammer to search engines. And they will remove your page from their results.

It’s Easy to Set Up 301 Redirects on Apache

Just use htaccess. Htaccess provides a lot more functionality than just password protection—and with one line you can redirect an entire directory to another URL, including a completely different web server.

How to Set up a 301 Redirect with HTAccess

  1. If you don’t have a .htaccess file in your root directory, open a new text file. If you do have one there, open it for editing.
  2. Add the line:
    Redirect 301 /PATH_TO_REDIRECT NEW_LOCATION_URI
  3. Change “/PATH_TO_REDIRECT” to the directory path on your web server you want moved.
  4. Change “NEW_LOCATION_URI” to the URL directory you want the pages redirected to.
  5. Save your .htaccess file and upload it to the root of your web server. Be sure the file name starts with a period!
  6. Test your redirect by going to the old URL in a web browser. If it’s working, you should end up at the new URL.

For example, if I redirected /about/webdesign to http://webdesign.about.com/ on my server, then every file that was requested in the /about/webdesign directory would point to the corresponding file on http://webdesign.about.com/. Even if that file had never been in the /about/webdesign directory.

This means that if you went to /about/webdesign/index.htm—you would be redirected to http://webdesign.about.com/index.htm. And if you went to /about/webdesign/od/htaccess/—you would be redirected to http://webdesign.about.com/od/htaccess/.

  1. About.com
  2. Computing
  3. Web Design / HTML
  4. Web Server Management
  5. HTTP
  6. 301 Redirect: Change Your URL Without Breaking Your SEO

©2014 About.com. All rights reserved.