How can I direct a domain name to a particular directory on my site?
There are a couple of ways to achieve this. Most of our customers opt to use a code snippet on their home pages to redirect the request. Here is a Cold Fusion example:
<CFIF CGI.SERVER_NAME eq "my2nddomain.com"
OR CGI.SERVER_NAME eq "www.my2nddomain.com">
<CFLOCATION URL="http://www.mydomain.com/2ndpage.htm">
</CFIF>
However, search engines may have trouble following this (CFLOCATION uses the "302" redirect, or temporary redirect). To use a permanent redirect, Macromedia suggests the following:
<CFIF CGI.SERVER_NAME eq "my2nddomain.com"
OR CGI.SERVER_NAME eq "www.my2nddomain.com">
<CFHEADER statuscode="301" statustext="Moved permanently">
<CFHEADER name="Location" value=" http://www.mydomain.com/2ndpage.htm">
</CFIF>
Through testing we have determined that this does not work, and will in fact use a 302 redirect. The work-around is:
<CFIF CGI.SERVER_NAME eq "my2nddomain.com"
OR CGI.SERVER_NAME eq "www.my2nddomain.com">
<cfheader statuscode="301"
statustext="Moved Permanently#Chr(13)##Chr(10)#Location:http://www.mydomain.com/2ndpage.htm">
</CFIF>
We also have a redirection service available, however it is not as customizable as the code above.
Another way to do this is by setting up a host-header site.
This question is also found in: