Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Want different default.html depending on domain name.


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
Jim_S
Asked:
Jim_S
1 Solution
 
mattisflonesCommented:
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
 
venkateshwarrCommented:
small correction,

request.servervariables("HTTP_HOST")
0
 
AndyCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
AndyCommented:
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
 
mattisflonesCommented:
Thnx venkateshwarr ;-)
0
 
Jim_SAuthor Commented:
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now