Two Domain Names On One Site
You have two domain names and ONE host. When someone types
into their browser www.domain.com you want them to come to
your main site. However, when they type in www.domain2.com
you want them to come to the same server, but have the
visitor see a different site.
Many servers have ways of re-directing two domains on one
site, but others do not. It still doesn't mean that it can't
be done. Here is one way I did it.
Many virtual servers are including PHP with your virtual
webspace. PHP is a language developed from C++ that works
similar to Server Side Includes (SSI) but has much greater
functionality. It can be used for numerous functions. Here
is how you can use it to re-direct the second domain name:
<? if (getenv ("HTTP_HOST")=="www.domain.com" or
getenv ("HTTP_HOST")=="domain.com") {
Header("Location: http://www.domain2.com/subdirectory/");
exit;
}
?>
In order for this script to work it must be placed as the
first thing on your HTML page above the opening tag.
Your "index.html" page as to have the extension changed and
now becomes "index.phtml" or whatever syntax is required by
your server.
| Back to Article Index |
Copyright © All Rights Reserved. The information/images on this website
may not be reproduced or republished by anyone without permission.