How to redirect your website to a new domain name.

If you are moving your site from one domain name to another you are going to want to redirect traffic from one site to the other. One thing to keep in mind is that search engines won’t necessarily know about the new site right away and a proper 301 Redirect can help. Using the META refresh tag isn’t a good idea because you could get penalized in your search engine rankings.

Search engines don’t really like duplicate data, so if you use a META refresh tag instead of an actual 301 redirect, your search engine ranking could actually drop. This is because there is still content being displayed when using the META refresh method. The problem with the 301 redirect is that most people don’t know how to do this without modifying their web server settings. Most hosting companies don’t allow the settings you need to do a proper redirect either.

The good news is if you run PHP or any other scripting language on your site you can programmatically set the 301 Redirect. The following is the php code that will modify your headers for a proper 301 redirect. <?php header( “HTTP/1.1 301 Moved Permanently” ); ?> Below is a better code base to use if you use a template based php website such as wordpres, phpNuke or even Joomla.

<?php
$page = $_SERVER[‘REQUEST_URI’];
header(‘HTTP/1.1 301 Moved Permanently’);
header(‘Location: ‘ . $page);
die;
?>

This code will not only provide the correct 301 redirect header search engines are looking for, but it will also tell the search engines and browsers where the page has moved to. All web browsers will also forward the user automatically to the new location. Using this code will help you easily move your website from one domain name to another if using a PHP based site.



Digg: DIGG ME

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.

Sponsor & Advertise
Tech Buzz

Zero-Day VBScript plagues Windows XP / 2000.

Apparently there is a new zero-day flaw that affects Windows XP and 2000 computers utilizing VBScript. An attacker can trick someone into visiting a website that binds the F1 key to a VBScript event which ultimately installs malicious code on your machine. Microsoft’s fix: Don’t press the F1 key when windows pop up. LOL. Ok [...]

Read More »

Has Verizon been hacked? Security certificates revoked!

Has Verizon been hacked? Google Chrome seems to think so. Just a few minutes ago I tried to log into Verizon to see why my phone isn’t making any calls and to also see why I can’t make any text messages. I’m going to have to probably assume they haven’t been hacked, but how does [...]

Read More »

My first blocked number in Google Voice.

Today I received my first piece of spam in Google Voice. At first I was really PISSED-OFF but then a feeling of serenity passed over my whole body as I noticed the “block” button. Slowly and cautiously I clicked it, making my day THAT MUCH better. Just knowing that I will no longer be getting [...]

Read More »

3500 Netflix on Linux petitions.

Currently you can not watch Netflix if you are a Linux user and all those new Ubuntu Netbook owners will not be watching Netflix anytime soon either. Watching movies online through Netflix is an awesome service, but worthless to Linux users. Netflix has chosen to only allow Windows and MAC users access to their online [...]

Read More »

Apple bans “android” from apps store.

Apples waving the ban stick around again, this time rejecting an educational iPhone app because it contained the word “Android”. The application? Flash of Genius: SAT Vocab 2.2, an iPhone app developed by Tim Novikof. The app did really well in the Android Developer Challenge that Google puts on and decided to mention that [...]

Read More »

My .02 on Apple’s anti-flash, anti-freedom movement.

As many of you iPhone consumers may know, Flash isn’t supported and will probably never be supported. The new up and coming iPad (Apple Tablet) will be running a version of the iPhone operating system and will probably have the same exact restrictions. The reason Apple doesn’t want to support Flash is because it allows third [...]

Read More »