Solved

Want different default.html depending on domain name.

Posted on 2004-03-29
6
204 Views
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.

    HTTP_HOST
    SERVER_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
Explorer.)

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


Jim S.
0
Comment
Question by:Jim_S
[X]
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
6 Comments
 
LVL 15

Expert Comment

by:mattisflones
ID: 10706337
Hi Jim_S,
In ASP:
<% if request.servercariables("HTTP_HOST")="www.thedomain.com" then *a redirect to unique html page*

Youll need one line per sitename..
Mattis
0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10706512
small correction,

request.servervariables("HTTP_HOST")
0
 
LVL 6

Accepted Solution

by:
Reapz earned 125 total points
ID: 10706528
In PHP...

If($_SERVER['HTTP_HOST'] == "www.yourdomain.com"){
     header("Location:http://www.somepage.php");
}
Elseif($_SERVER['HTTP_HOST'] == "www.someotherdomain.co.uk"){
     header("Location:http://www.anotherpage.php");
}
0
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!

 
LVL 6

Expert Comment

by:Reapz
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! :)
0
 
LVL 15

Expert Comment

by:mattisflones
ID: 10707074
Thnx venkateshwarr ;-)
0
 

Author Comment

by:Jim_S
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.

Jim

0

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 (http://www.experts-exchange.com/members/eplummer26.html) 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