derrick1123 Posted June 23, 2008 Share Posted June 23, 2008 I didn't know how to do this, or if this was even possible. I have to domains going to the same IP. I need to get Domain 1 to go to Folder 1, but if someone goes to Domain 2 then I want them to go to Folder 2. <?php $domain['sw337'] = "sw337.mydomain..."; //domain 1 $domain['sfuk'] = "sfuk.mydomain..."; //domain 2 if ($domain['sw337']) { echo "Go <a href=" . $domain['sw337'] . "/en'>here</a>"; //domain 1 } else { echo "Go <a href=". $domain['sfuk'] . "/sfuk'>here</a>"; //domain 2 } ?> Quote Link to comment Share on other sites More sharing options...
dmccabe Posted June 23, 2008 Share Posted June 23, 2008 Now I am no expert but I can tell you that: $_SERVER['REQUEST_URI'] is the code find the current url and to re-direct them you use: header("location:<url goes here>"); Quote Link to comment Share on other sites More sharing options...
derrick1123 Posted June 23, 2008 Author Share Posted June 23, 2008 But I need it to be were if they go to: http://sfuk.mydomain... then it will automatically go to the /sfuk folder. Quote Link to comment Share on other sites More sharing options...
whizard Posted June 24, 2008 Share Posted June 24, 2008 That's a subdomain. Your host's CP should have a tool for setting them up. Dan Quote Link to comment Share on other sites More sharing options...
derrick1123 Posted June 24, 2008 Author Share Posted June 24, 2008 I am my host...lol I am hosting the website from my pc. I don't have a CP I just have apache and PHP install. With the essentials of MySQL ^.^ Quote Link to comment Share on other sites More sharing options...
whizard Posted June 24, 2008 Share Posted June 24, 2008 oh.... then, you should be able to write an .htaccess for that, I think. There are a few websites that can even spit out the correct .htaccess for you on google. Quote Link to comment Share on other sites More sharing options...
derrick1123 Posted June 24, 2008 Author Share Posted June 24, 2008 I have been googling a lot of websites, but I don't think I am looking in the right place. What am I suppose to be looking for? All I see is Re-right url...Is this the right url? Quote Link to comment Share on other sites More sharing options...
peranha Posted June 24, 2008 Share Posted June 24, 2008 Are you on a windows server, or a linux server?? Quote Link to comment Share on other sites More sharing options...
derrick1123 Posted June 24, 2008 Author Share Posted June 24, 2008 Windows VISTA I have been trying to get it to work with .htaccess... This is what I have so far: Options +FollowSymlinks RewriteEngine ON RewriteCond %{HTTP_HOST}!^sw337\.servegame\.com RewriteRule^(.*)$ http://sw337.servegame.com/en RewriteCond %{HTTP_HOST}!^sfuk\.servegame\.com RewriteRule^(.*)$ http://sfuk.servegame.com/sfuk Quote Link to comment Share on other sites More sharing options...
peranha Posted June 24, 2008 Share Posted June 24, 2008 I just asked the same thing for my Server, only it is a win 2000 server and it works on there http://www.phpfreaks.com/forums/index.php/topic,199919.0.html There is a host file here \Windows\system32\drivers\etc\ And you need to change the vhosts in apache. i gave my config files in the thread so if you need help, let me know. Quote Link to comment Share on other sites More sharing options...
derrick1123 Posted June 24, 2008 Author Share Posted June 24, 2008 Where is the Vhost located in apache ? My computer doesn't have system32 ??? Quote Link to comment Share on other sites More sharing options...
peranha Posted June 24, 2008 Share Posted June 24, 2008 vhosts is located in Apache\config\extra\httpd-vhosts.conf This is the path to my hosts file. C:\Windows\System32\drivers\etc\hosts this is on a Vista laptop, so you may have to unhide all files and folders, and system folders, not sure though. Quote Link to comment Share on other sites More sharing options...
derrick1123 Posted June 24, 2008 Author Share Posted June 24, 2008 Oh well, does the System32 host file really matter? Quote Link to comment Share on other sites More sharing options...
peranha Posted June 24, 2008 Share Posted June 24, 2008 yes, that is where you have to put the subdomains 127.0.0.1 localhost 127.0.0.1 newsite.localhost 127.0.0.1 work.localhost Quote Link to comment Share on other sites More sharing options...
derrick1123 Posted June 24, 2008 Author Share Posted June 24, 2008 OK, well can you tell me what that host file's name is? I can search for it... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.