Solved

Want different default.html depending on domain name.

Posted on 2004-03-29
6
199 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
6 Comments
 
LVL 15

Expert Comment

by:mattisflones
Comment Utility
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
Comment Utility
small correction,

request.servervariables("HTTP_HOST")
0
 
LVL 6

Accepted Solution

by:
Reapz earned 125 total points
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 6

Expert Comment

by:Reapz
Comment Utility
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
Comment Utility
Thnx venkateshwarr ;-)
0
 

Author Comment

by:Jim_S
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to count occurrences of each item in an array.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now