?
Solved

Want different default.html depending on domain name.

Posted on 2004-03-29
6
Medium Priority
?
207 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:
Andy earned 500 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 6

Expert Comment

by:Andy
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

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

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

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
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…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

741 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