内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

利用php怎么強制用戶轉(zhuǎn)向www域名-創(chuàng)新互聯(lián)

利用php怎么強制用戶轉(zhuǎn)向www域名?很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細講解,有這方面需求的人可以來學習下,希望你能有所收獲。

成都創(chuàng)新互聯(lián)-成都網(wǎng)站建設公司,專注成都網(wǎng)站設計、成都網(wǎng)站建設、網(wǎng)站營銷推廣,國際域名空間,網(wǎng)絡空間,網(wǎng)站托管維護有關企業(yè)網(wǎng)站制作方案、改版、費用等問題,請聯(lián)系成都創(chuàng)新互聯(lián)。
// Install info.:
// Copy and paste these lines into your default index.php or
// the file that get's called if a visitor comes on your 
// website...
// read the host from the server environment
$host = $_SERVER["HTTP_HOST"];
// fix host name - we never now... ;-)
$host = strtolower($host);
$host = trim($host);
// This is important: 
// Webbrowsers like Firefox are doing their request without
// the port number like "www.jb51.net" but some other 
// applications send host names like "www.jb51.net:80" 
$host = str_replace(':80', '', $host);
$host = trim($host);
// if the host is not starting with www. redirect the 
// user to the same URL but with www :-)
if ($host != 'www.jb51.net'){
  // You an also change the "!=" to "==", if you want to force 
  // the user to use the domain name without the www. 
  // send status header, so that search engines or other services
  // detect that this is a permanent redirect and not a temporary
  header('HTTP/1.1 301 Moved Permanently');
  // read the URL the user requested:
  $url = isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : '';
  // redirect the user to the new destination:
  header('Location: https://www.jb51.net' . $url);
  // Convert "special" chars -- cause we never now... ;-)
  $url = htmlspecialchars($url);
  // "fallback" link, if the browser is not supporting header redirects
  print '<a href="https://www.jb51.net' . $url.'">Please click here</a>';
  // stop the script execution here
  exit;
}
// If the domain is www.jb51.net then go on with your PHP code 
// of with your website...
// BTW: You need to replace jb51.net trough your own domain :-D

看完上述內(nèi)容是否對您有幫助呢?如果還想對相關知識有進一步的了解或閱讀更多相關文章,請關注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對創(chuàng)新互聯(lián)網(wǎng)站建設公司,的支持。

網(wǎng)頁題目:利用php怎么強制用戶轉(zhuǎn)向www域名-創(chuàng)新互聯(lián)
分享鏈接:http://www.rwnh.cn/article6/dgheig.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站服務器托管、標簽優(yōu)化、網(wǎng)站內(nèi)鏈網(wǎng)站營銷商城網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名
东辽县| 稻城县| 苏尼特右旗| 商城县| 溆浦县| 酉阳| 保康县| 金山区| 吉安县| 璧山县| 东阿县| 景洪市| 德昌县| 襄汾县| 安远县| 银川市| 偃师市| 惠州市| 木里| 信宜市| 诸城市| 黄梅县| 香格里拉县| 吉首市| 普兰店市| 五莲县| 阿拉尔市| 绥德县| 庄河市| 马尔康县| 定南县| 兴仁县| 马鞍山市| 苍山县| 扎囊县| 大埔县| 余江县| 荃湾区| 长泰县| 琼海市| 武穴市|