Tag Archives: http redirect

Changing Domains and 301 Redirects

If you want to move your business to a new domain and you have a popular domain name with a decent Google Page rank you will most certainly want to redirect traffic from your old website to your new website.

There are many ways to do this. Some of the most popular are:

  • using meta tags: this is a client side method that redirects the browser after a certain amount of time
  • using a server side script: this could be a simple .php that redirects users from a page (generally homepage) to your new site
  • use a .htaccess file and a rule to redirect traffic to your new site


The meta refresh mechanism is quite simple, you insert code like this into the header of the page you wish to redirect:

<META http-equiv=”refresh” content=”5;URL=http://www.yournewsite.com/”>

This will redirect to your new site 5 seconds after the page loads on the viewer’s browser.  This method is simple and require no server side scripting knowledge.


With languages like php you can use the header function to redirect to other pages. Here is an example of how to perform a 301 redirect with php.

header( “HTTP/1.1 301 Moved Permanently” );
header(‘Location: http://www.yournewsite.ie/’);

NOTE: this code must appear at the top of the .php file as if the script echoes anything at all to the client the redirect will not work.

This method is good as it performs a proper 301 redirect so that your new site picks up all of the page rank associated with the old page, the only disadvantage here is that it must be done page by page.

This 301 has been tried and tested on http://www.utdwebdesign.com and redirects to http://www.utdwebdesignireland.com


This is the preferred method of performing a 301 redirect for all pages of a site but only works on Linux hosting. Here is an example of a .htaccess file with a 301 redirect rule for all pages of a website:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^yournewsite.com$ [NC]
RewriteRule ^(.*)$ http://www.yournewsite.com/ [L,R=301]

This .htaccess 301 Redirect has been tried and tested on Godaddy hosting for the website http://www.barrackstreetconcertband.com and redirects the user to http://www.barrackstreetband.com