a1amattyj Posted January 28, 2008 Share Posted January 28, 2008 Hello, Im wanting to add a new parked domain to my existing site www.smfnew.com. So naturally, every file which is shown via smfnew.com will also show on my new domain im going to add(smffree.net). However, what i want to do is that if the user types in smfnew.com (directs to http://www.smfnew.com/home.php) that is displays what it does now, but if they type in smffree.net, it will display diffrently. Here is what i thought of.. In home.php place: <?php if($_SERVER['SERVER_NAME']=="smfnew.com"){ echo "testtext1"; }else{ echo "text2"; } ?> However, on my test script (testing this before i use it) if you go to www.smfnew.com/domain.php (put script here) it will show the second statement. Any suggestions on why it does this? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/88210-solved-php-domain-decide-content/ Share on other sites More sharing options...
PHP Monkeh Posted January 28, 2008 Share Posted January 28, 2008 You're probably looking for $_SERVER['HTTP_HOST'] Quote Link to comment https://forums.phpfreaks.com/topic/88210-solved-php-domain-decide-content/#findComment-451379 Share on other sites More sharing options...
a1amattyj Posted January 28, 2008 Author Share Posted January 28, 2008 You're probably looking for $_SERVER['HTTP_HOST'] Hi, this makes no difference on result. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/88210-solved-php-domain-decide-content/#findComment-451387 Share on other sites More sharing options...
PHP Monkeh Posted January 28, 2008 Share Posted January 28, 2008 Try echo-ing the value of $_SERVER['HTTP_HOST'] or $_SERVER['SERVER_NAME'] and access the page from both domains, and see what it outputs. Quote Link to comment https://forums.phpfreaks.com/topic/88210-solved-php-domain-decide-content/#findComment-451401 Share on other sites More sharing options...
a1amattyj Posted January 28, 2008 Author Share Posted January 28, 2008 Try echo-ing the value of $_SERVER['HTTP_HOST'] or $_SERVER['SERVER_NAME'] and access the page from both domains, and see what it outputs. <?php if($_SERVER['HTTP_HOST']=="smfnew.com"){ echo "testtext1"; }else{ echo "text2"; } ?> <? echo $_SERVER['HTTP_HOST']; ?> http://www.smfnew.com/domain.php Quote Link to comment https://forums.phpfreaks.com/topic/88210-solved-php-domain-decide-content/#findComment-451414 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.