Azu Posted May 25, 2007 Share Posted May 25, 2007 Would somebody please tell me how I can use PHP to detect the domain that is being used? Or just detect the full URL? Because I have more then 1 domain and I want to redirect the others to the first one, so that google won't think I am using duplicate content and penalize me for it. So like either a way to detect what the domain is (E.G. domain2.com) so that I can redirect to domain1.com Or just a way to detect if it ISN'T domain1.com, and redirect to domain1.com if it isn't? Because I like to register more then 1 domain for common misspellings, like the way google has gooogle.com redirect to google.com So.. please tell me how I can somehow detect this in PHP I would appreciate it thanks ^^ Quote Link to comment https://forums.phpfreaks.com/topic/52940-solved-detecting-domain/ Share on other sites More sharing options...
Silverado_NL Posted May 25, 2007 Share Posted May 25, 2007 $check = $_SERVER['SERVER_NAME']; if($check == "domain1"){ //in case user is visitiing domain1 }elseif($check == "domain2"){ //in case user is visitiing domain2 } does this help you??? greetingz Silverado Quote Link to comment https://forums.phpfreaks.com/topic/52940-solved-detecting-domain/#findComment-261433 Share on other sites More sharing options...
Azu Posted May 25, 2007 Author Share Posted May 25, 2007 Thank you that is exactly what I was looking for Quote Link to comment https://forums.phpfreaks.com/topic/52940-solved-detecting-domain/#findComment-261447 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.