By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,335 Members | 2,718 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,335 IT Pros & Developers. It's quick & easy.

How to redirect based on url (various domain aliases) entered by visitors

P: 1
I am a php newbie and am trying to write a script that will direct visitors to specific pages on my website based on which of several url’s they have entered (all are aliases of the main website).
While all visitosr will be directed to the same website, I want them to start at specific pages based on their interests, rather than having to drill down from various menus.

For example, let us call the main doman abc.com.

I have the following domains which are being used as aliases:

abcfurniture.com
abcbooks.com
abcgifts.com
abcfood.com
abcstationery.com

So if a visitor enters abcfurniture.com, I want them to go to:

abc.com/furniture.html

etc. etc.

I know that I can use Header and location to direct them to a specific page. The question is how do I capture exactly which url they have entered.

I was thinking perhaps of $_SERVER[HTTP-HOST] to capture the url entered. Then I could use if ... then statements, or case, or switch with

header('Location: http://www.abc.com/furniture.html');

Any suggestions as the best way of doing this?

Incidentally, in researching this question, I have found numerous related questions involving visitors from old
pages, etc., but very little on using one domain with a number of aliases.

Your help is greatly appreciated.
May 19 '07 #1
Share this Question
Share on Google+
1 Reply


pbmods
Expert 5K+
P: 5,821
Probably the easiest thing to do is set up domain forwarding with your hosting provider.

Domain forwarding does exactly what you are looking for; when a User goes to a domain with forwarding set up, he is automatically redirected to a URL of your choosing.
May 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.