PHP newbie, please tell me how to jump to a web page based on the domain name?
新疆塔城[HAM]陈
新疆塔城[HAM]陈 2020-02-17 23:22:02
0
3
1260

3 top-level domain names

www.123.com

www.pass.cn

www.sohu.cn


Different domain names, I want to automatically go to different subdirectories.

www.123.com/doc

www.pass.cn/soft

www.sohu .cn/video


Please give me some advice, how to write the PHP code for this homepage?

新疆塔城[HAM]陈
新疆塔城[HAM]陈

reply all(2)
新疆塔城[HAM]陈

Please give me some guidance.



排骨

Stupid method

$_http = $_SERVER['HTTP_HOST'];

if($_http == 'www.123.com'){

header("LOCATION:http://www.123.com/doc");

}elseif($_http == "pass"){

// Same as above

}elseif(xxxx){

//Same as above

}else{

echo "Incorrect address input";

}

  • reply Thanks for the answer, Paigu, I am a real novice, it is my first time to come into contact with this stuff. Can you provide the complete PHP file code? Copy the above code and when browsing, an error message appears.
    新疆塔城[HAM]陈 author 2020-02-19 14:55:14
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template