Change Home page depending on Domain

Helping someone set up a website. Their outfitting business does hunting trips, Wilderness pack trips, and river fishing trips. They are considering multiple domain names to target each market. Could these all be set up on one site and have the home page be different based upon what domain they asked for. I think with frame forwarding the hunting domain could be pointed at a `hunting' page.

The reason I am asking is that almost all the content is identical. What we want to do is have the pack trip people see a home page that really emphasizes pack trips and have the hunting visitors see a home page that emphasizes hunting, etc. The rest of what the visitors see would be identical. They could be hosted separately but for ease of maintaining the site this would be simpler. The only problem I see is if you wanted to analyze traffic it is harder to tell what brought them to the site.

Suggestions/Comments appreciated
LVL 1
emery_kAsked:
Who is Participating?
 
mouattsConnect With a Mentor Commented:
There are two basic ways of doing this. One is that you set up a primary domain and the domain pointers for the other domains and process the incoming request to determine which page you are using.

The second is to set up seperate domains that point to the same directories but use a different default document. Realistically with an ISP this will not normally be an option.

So to do the first one, and all servers can do this, youi default page needs to point to a script rather than a bit of plain HTML (eg ASP as Bruno suggested)

This script looks at the server variable HTTP_HOST which will contain the host name that the user requested ie wildernesstrips.com, fishingtrips.com or shootingdefencelessanimals_becauseimimpotent.com
It then either changes the output or redirects to the approriate page based on this.

From the ISPs point of view you will need them to set up the domain and the domain pointers but thats about it really.

HTH
Steve
0
 
brunoCommented:
>>these all be set up on one site and have the home page be different based upon what domain they asked for.


absolutely.


i forget all the steps, but i know this could be done using IIS and ASP.


What do you have available?
0
 
emery_kAuthor Commented:
They are going to be changing hosts. What do we need to make sure is on the server and what do we need on our side?

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
brunoCommented:
Well, you could probably do it with most any server setup, but I'm only familiar with MS.....I'm sure someone else around here would be able to tell you how do it with a different setup....
0
 
emery_kAuthor Commented:
Steve
Thanks, that is a real clear explanation. I am checking with the ISP to see what the options are. The company (buydomains) that the names are registered with do either URL forwarding or Frame forwarding and one of those might work. I'm not real clear where the difference is between what they can set up and what is at the ISP. At this point we are doing a simple DNS entry to an IP address through them. Get back to you in a couple of days.
0
 
brunoConnect With a Mentor Commented:
emery,

I'd stay away from frame forwarding if you can, if simply to avoid bookmarking issues...


BRUNO
0
 
emery_kAuthor Commented:
Comments appreciated
I am researching this to make sure I understand it. It occurred to me if the site is www.outfitter.com and the fishing site (www.fishing.com) is set to go to www.outfitter.com/fishing.htm that works for when they first get to the site BUT if they go into the contact page then hit the home link that will take them to www.outfitter.com/home rather than going back to the fishing.htm page as the `home'. Am I correct and is there a way around this?
Thanks for the help
0
 
brunoCommented:
well, i suppose you could set a session variable....mmm perhaps a cookie would work better, when you first come to the site, so at session_onstart, set a cookie saying which URL was used.

then, built the home link dynamically on each page, depending which URL was used to get there.


BRUNO
0
 
mouattsCommented:
emery:

Ignoring the problems I outlines earlier there are two possible ways in which this can be done and the method used effects the potential problem that you have seen.

Method 1 is to create seperate domains that simply point to the same area but to achieve what you want the home page of fishing.com would be set as fishing.htm. So a home (so long as you always used relative URLs) will always return to the correct place.

Method 2 is to create one domain then add fishing.com as a domain pointer. To get this to point to a particular home page you will need to place code/a script etc for the home page of outfiters.com so that if the incoming host name is fishing.com it redirects to fishing.htm. So long as you never want to see the outfitters home page within fishing.com this will continue to work (again so long as you use relative URLs). If you do want to see outfitter home page within fishing.com then all you would need to do is modify the script within the home page so that it directs to the correct home page for each site (ie the outfitters homepage would not be the default page for the domain but would appear as such due to the redirection.

HTH
Steve
0
 
emery_kAuthor Commented:
Steve
Now to study up on Relative URLs and domain pointers.
In some ways hosting them separately is simpler but more work for maintaining site. That would also be easier to analyze traffic. The comments from all are clarifying our options and appreciated.
0
 
emery_kAuthor Commented:
Bruno
Not ignoring your comment. Haven't used cookies before so researching that also.
It's challenging to learn and interesting to see the different approaches. Often the solution chosen here is probably the one the questioner is most comfortable with and not necessarily the best or most elegant. This is a great forum with some really great people.
0
 
emery_kAuthor Commented:
Bruno
Not ignoring your comment. Haven't used cookies before so researching that also.
It's challenging to learn and interesting to see the different approaches. Often the solution chosen here is probably the one the questioner is most comfortable with and not necessarily the best or most elegant. This is a great forum with some really great people.
0
 
brunoCommented:
emery,

that's fine, it's not even something I would be able to walk you through....I know a lot more of what is possible to do than I would actually know HOW to do myself...  ;-)


If you need help though, just say so I'll try my best.


BRUNO
0
 
mouattsCommented:
Emery
Having seperate domains doesn't have to mean more effort in maintaining them as the actual pages can be shared. Its just the configuration of each domain that will vary slightly.

Steve
0
 
emery_kAuthor Commented:
Steve
That is what we were hoping for. Since 90%+ of the content will be identical we're hoping to make it easy for the customer long term. That does mean doing the homework now to determine the best direction to go. And as Bruno said figuring out what can be done is the first step, then we have to determine how to actually do it.
There is some concern about knowing what hits are coming from where for what site but that is a secondary issue.
Now to crack the books on suggestions so far.

Emery
0
 
mouattsCommented:
If you are using seperate domains (ie seperate web servers) the stats will be held seperately for each site.

If using a domain pointer then the referer, where present will indicate which domain name was used. Thus in your case a hit to fishing.html from fishing.com will have either no referer or a referer that is not one of your domains. A hit on fishing.html from outfitters.com will have outfitters.com within the referer.

Incidentally an absolute URL is one that contains the domain name within it, and a relative URL is one that doesn't.

Normally you should use only relative URLs within a site. The only exception to this is when a redirection is needed then an absolute URL must be used. If using ASP this is handled dynamically so that you can use a relative URL and the server tacks on the relevent domain name. Within other environments you would normally need to construct the absolute URL from the server environment variables to keep the relative flavour of things.

Steve
0
 
shaggz1222Commented:
You could probably do this with a Host Redirect Script

http://www.kastle.net/products/hostredirect/

Has one ....
0
 
shaggz1222Commented:
Woops, I mean the URL Redirect Script:

http://www.kastle.net/products/URLredirect/


Description of this Perl Script:

 A extremely handy script that allows you to have multiple domain names registered to one (1) IP address and have them all redirected to a sub site of another. For example, you register search.your-domain.com, chat.your-domain.com and scripts.your-domain.com. Instead of having to use 3 extra IP's, you can redirect to your-domain.com/search, you-domain.com/chat.....


Hope that works for ya!
0
 
mouattsCommented:
Err shagz1222 thats kind of what has already been said, except that you shouldn't need to do multihoming via a script if you set the server up correctly.
0
All Courses

From novice to tech pro — start learning today.