Connecting Tech Pros Worldwide Help | Site Map

Redirect based on request.

THG THG is offline
Newbie
 
Join Date: Dec 2007
Posts: 2
#1: Dec 16 '07
So here is my story. I have one host, and many websites. So I need a redirect based on the request. Currently if someone types in some of my websites, such as comptutes.com or xboxachieve.com, they will both go to the exact same page (index.html).

I need a redirect that says, if the person typed in xboxachieve.com, they will be redirected to "xboxachieve.com/x/index.html". Likewise, if someone types in comptutes.com, they should get "comptutes.com/c/index.html", etc..

Many thanks in advance.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#2: Dec 16 '07

re: Redirect based on request.


a javascript way:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. window.location = 'http://yoursite.com/directory/index.html'
  3. </script>
  4.  
a PHP way:
[php]
<?php
header("Location: http://yoursite.com/directory/index.html");
?>
[/php]
hope this helps :)
Reply