Lots of people ask me what the difference between using the
Meta Refresh tag verses using the
.htaccess 301 redirect function is, so I am here to explain their differences.
So what is the Meta Refresh Tag?
Mostly people want to use this in the
<head> section of their webpage to redirect to a different page/site. For instance, let’s say you had a page that once lived at
domain.com/awesome.html but now it is actually located at
domain.com/pretty-cool.php. It may be hard to reach out to all of your visitors, or you have a great search ranking you don’t want to mess up. You can go into your old page file and add something like this:
<meta http-equiv="refresh" content="0;'http://domain.com/pretty-cool.php'" />
This now lets your visitor go straight to the new location without them having to think. So far so good, right? Not exactly…
Biggest problem with Meta Refresh is lots of sites use this method to redirect you to rogue or completely different sites. You probably don’t want your visitors, or Google, thinking you are trying to send your visitors to some completely different place. You can do this for a short period of time as a bandaid, but I definitely would not recommend it for a long period of time.
So, what do you do instead?
This is to tell your site, users, and Google you are permanently changing the location of the page. Most importantly it tells all search engines “hey, the website or page has moved – please don’t hurt me, just look over here now.”
How to do a 301 Redirect is pretty simple.
Open your .htaccess file (or create one) found in your root directory and add a new line:
Redirect 301 http://domain.com/awesome.html http://domain.com/pretty-cool.php
If you want to redirect entire site to a new site, and not just files, you can do this:
Redirect 301 / http://domain2.com/
Save the .htaccess file, make sure it’s on your site, and you are done.
Different types of Redirects:
301 = permanent
302 = temporary