Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect to a page on the server, based on domain name entered.

Status
Not open for further replies.

nwruiz

Programmer
Jun 22, 2005
60
US
Hello. I have an interesting question. I currently have two websites: DealMerchant.net and NicksDomain.net. DealMerchant.net is my deal-related website where I provide a daily list of new deals and coupons, while NicksDomain.net is a personal website. Lately, I have been unhappy with the server that DealMerchant.net is on, since at times, my pages take a couple of minutes to load on a T1 line. I would like to move the website to the server that NicksDomain.net is on, since it is always speedy. However, I do not want to overwrite any files.

My question is, on the server's index page for my site, would it be possible to process the domain name that the user entered to visit the site, and redirect the page to the corresponding section? For example, if the user were to enter in could I read the url in and redirect the user to a directory /BETA2/, so that the user would see in their browser, while if they entered it would redirect to a directory named /nick/?

By doing so, I would be able to manage two different websites on the same server. Also, if this is possible, would I encounter any problems if the user were to just link to
Also, if there would be an easier way to do this, I'm open for suggestions.

Nick Ruiz
CO-OP Intern, PPL Electric Utilities
Webmaster, DealMerchant.net
 
Two web sites can share the same server or even the same IP address. Just use name-based virtual sites with different document roots. Any HTTP/1.1-compliant web server can do this.

How, exactly, you would set this up is a question best suited to forums specific to your web browser.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I suppose I should be more specific, but from what it sounds, this probably now migrated from being PHP related to web hosting/design related. I am registered under a hosting service, so I do not have my own server. Basically, what I was trying to do is point 2 domain names to the same web account and then use the index page to redirect. So on that note, I should probably try to find the forum that relates to this topic better.

Nick Ruiz
CO-OP Intern, PPL Electric Utilities
Webmaster, DealMerchant.net
 
You could use the $_SERVER["HTTP_HOST"] variable, and then the PHP header() function.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top