多域名解析到同一网站C的php重定向代码
生活随笔
收集整理的這篇文章主要介紹了
多域名解析到同一网站C的php重定向代码
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
在index.php最前面加上以下代碼:
<?php if(strpos($_SERVER['HTTP_HOST'],'afish.cnblogs.com')===false){#header('Location: http://afish.cnblogs.com/');echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"> <head> <title>afish.cnblogs.com</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="keywords" content="afish.cnblogs.com" /> <meta name="description" content="afish.cnblogs.com" /> </head> <body> <iframe width="100%" scrolling="no" height="2800" frameborder="0" src="http://afish.cnblogs.com"></iframe> </body> </html>';exit(); } ?>若要實(shí)現(xiàn)直接跳轉(zhuǎn),只需將#header('Location: http://afish.cnblogs.com/');前面的#號(hào)去掉即可。
若要實(shí)現(xiàn)點(diǎn)擊鏈接后再跳轉(zhuǎn),注釋header('Location: http://afish.cnblogs.com/');這一句即可。
?網(wǎng)站C頁面head頭部添加代碼:
<base href="http://afish.cnblogs.com/" target="_parent" />打完收工!
?
轉(zhuǎn)載于:https://www.cnblogs.com/afish/p/4501708.html
總結(jié)
以上是生活随笔為你收集整理的多域名解析到同一网站C的php重定向代码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 填充
- 下一篇: PHP多进程处理并行处理任务实例