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 } ?> Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/ 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>"); Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572151 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. Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572696 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 Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572762 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 ^.^ Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572770 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. Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572824 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? Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572875 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?? Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572877 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 Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572933 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. Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572938 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 ??? Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572944 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. Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572948 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? Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572951 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 Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572952 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... Link to comment https://forums.phpfreaks.com/topic/111469-if-this_domain-this-page-else-this-other-page/#findComment-572964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.