Your tech lesson of the day: 301 Redirects

What is a 301 redirect?

The HTTP standard defines several status codes for redirection:
* 300 multiple choices (e.g. offer different languages)
* 301 moved permanently
* 302 found (originally temporary redirect, but now commonly used to specify redirection for unspecified reason)
* 303 see other (e.g. for results of cgi-scripts)
* 307 temporary redirect

Why do you want to use 301 redirects when possible?

Google will transfer your existing search rankings and good keywords. Users will arrive at the new site seamlessly.

How to do you create a 301 redirect?

What is different about a meta refresh tag or javascript redirect

A meta refresh tag or ( <meta http-equiv=”refresh” content=”0;url=”> ) a javascript redirect (window.location = waits for the window content to load, then tells the browser to go to the new location.
A 301 redirect will send the user along to the new location before any content is served by using http headers.

Why should you avoid meta refresh / javascript?

Googlle bots don’t have javascript enabled. They don’t follow meta refresh pages. And your users will actually see the old page load, depending on how quick their browser is. It’s just not a great way to do a redirect, but sometimes the server doesn’t have the capability to give a 301, or you don’t have admin privileges to set one up.

Can you give me an example of a .htaccess file redirect?

The file will look like this:
RewriteEngine on
RewriteRule (.*) [R=301,L]

What does that mean?

  1. turn on the apache rewrite module
  2. (.*) is a regular expression which means any character, any number of times, or basically, everything
  3. followed by the site it should go to
  4. and R=301 sets the 301 code. L means it’s the last rule that applies, don’t look for any more rules

Why are we getting rid of GoDaddy?

In addition to being a slow host for wordpress, GoDaddy only reads the .htaccess files once every few hours. This makes it VERY difficult to know if your .htaccess file has errors, and if it does have errors you site may not work for a few hours. By comparison, other hosts read the .htaccess file on every page load. This is the way it’s supposed to be done.
Hostnine has a lot better control panel for managing all of the domains. In addition, they have the cPanel which makes maintaining individual domains a lot easier.

Related Posts:

  • No Related Posts
This entry was posted in Tech Opinion, Web Development. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *