Why Do You Need to Buy Multiple Domains? - Redirecting Your Traffic Across Domains
(Page 4 of 4 )
There are several simple scripts you can use if you want to direct traffic from one of your domains to another (respectdtech vs. respectdatech, for instance). Use one of these codes on the page you’d like to re-direct:
ColdFusion
<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.respectdatech.com">
PHP
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.respectdatech.com" );
?>
ASP
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.respectdatech.com/"
%>
ASP .NET
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.respectdatech.com");
}
</script>
JSP (Java)
<%
response.setStatus(301);
response.setHeader( "Location", "http://www.respectdatech.com/" );
response.setHeader( "Connection", "close" );
%>
CGI PERL Redirect
$q = new CGI;
print $q->redirect("http://www.respectdatech.com/");
Ruby on Rails
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.respectdatech.com/"
end
Your misspelled domain need only have one of these scripts in order to send traffic in the right direction. When you’re moving visitors from one URL to another, it’s important to be careful. You don’t want to use META refresh, and you don’t want to create a mirror site for moving traffic. The extra domain has only one purpose: keeping your traffic in the right place. Use the right codes to direct them, and your multiple domains should work beautifully together.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |