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

Reapz 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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
website file permissions 4 87
Problem to echo 6 116
Problem to picture file 3 91
removing a class in javascript 4 95
Shoutout to Emily Plummer ( for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

739 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