Happens mostly when beta testing on a temporary subdomain, and one day, you wanna move, but what will happen to all the incoming links?
There is one method for a TEMPORARY domain change [302] (for maintenance or something similar) , and there is one for a PERMANENT domain change [301].
Two good methods, via .htaccess via PHP or via HTML:
The htaccess redirection method:
redirect 301 / http://newDomain.com For a PERMANENT redirect, or
redirect 302 / http://newDomain.com
For a TEMPORARY redirect.
The PHP redirection methods:
header('HTTP/1.1 301 Moved Permanently', true);
header('Location: http://newDomain.com/');
For a PERMANENT redirect, or
header('Location: http://newDomain.com/');
For a TEMPORARY redirect.
The HTML redirection method:
<meta http-equiv=refresh content="0; url=http://newDomain.com" />
NOTE: The 0 (Zero) can be changed to a number of seconds you'd like the browser to wait before redirecting. Usually used to display a "We have moved" notice.
NOTE2: When using 0 (zero) as the timeout param, Google/Yahoo will treat it as a 301 PERMANENT move, while when using a higher timeout duration they will treat it as a 301 TEMPORARY move.
No comments:
Post a Comment