Solved

Want different default.html depending on domain name.

Posted on 2004-03-29
6
200 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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…

919 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

19 Experts available now in Live!

Get 1:1 Help Now