PHP redirect to a domain if the called domain is equal to another domain

Question: Is it possible to redirect a user opening a domain to a different domain through the use of PHP?
Say the user goes to www.domainA.com and I want to redirect them to www.domainB.com, how would I do so without the use of a meta refresh? Possible?

Answer:
$host = $_SERVER['HTTP_HOST'];$hosts array(
    'roganmedical.com' ,
    'roganmedical.com' ,
    'www.roganmedical.com' ,
    'http://roganmedical.com' ,    'http://www.roganmedical.com' ,    'rogan-medical.ch' ,    'www.rogan-medical.ch' ,    'http://rogan-medical.ch' ,    'http://www.rogan-medical.ch' ,    'schmerzen-wastun.ch' ,    'www.schmerzen-wastun.ch' ,    'http://schmerzen-wastun.ch' ,    'http://www.schmerzen-wastun.ch'    );if(in_array($host, $hosts)) {    header('Location: http://www.roganmedical.ch');}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.