Want different default.html depending on domain name.

Posted on 2004-03-29
Last Modified: 2012-05-04

I have several domain names pointing to exactly one web site.  
From watching other web sites, it seems possible to show a
different default.html page from one web site depending on which
domain name was used to access the web site.  I do not know
how to do this and would like help.

My cgi/perl scripts see the following two environment variables,
both of which are set to the domain name.


However default.html is not a perl script.  How do I get default.htm
to recognize the domain name?

The web site runs on Windows 2000.

My own skills include basic (not advanced) HTML and Perl.  I have
never used ASP nor PHP.  I have done JavaScript, but just a
little. I would rather not rely on the user having scripting
enabled.  (It is so easy to turn off scripting in Internet

Where do you recommend I go from here to show different default
web pages for different domain names?

Jim S.
Question by:Jim_S
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 15

Expert Comment

ID: 10706337
Hi Jim_S,
<% if request.servercariables("HTTP_HOST")="" then *a redirect to unique html page*

Youll need one line per sitename..
LVL 12

Expert Comment

ID: 10706512
small correction,


Accepted Solution

Andy earned 125 total points
ID: 10706528
In PHP...

If($_SERVER['HTTP_HOST'] == ""){
Elseif($_SERVER['HTTP_HOST'] == ""){
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 10706542
If you know Perl then PHP will be easy for you. I used to do everything with CGI scripts and that takes ages. Then I woke up to PHP! :)
LVL 15

Expert Comment

ID: 10707074
Thnx venkateshwarr ;-)

Author Comment

ID: 10707393
Thank you all for such a quick reply.  Looks
like my answer is that I had better learn either
ASP or PHP.  (I am glad to hear that the answer
does not depend on client-side JavaScript.)

I am accepting Reapz's answer rather than
mattisflones/venkateshwarr's, only because I am
more inclined to learn PHP than ASP.  I appreciate
all your efforts.



Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question