簡體   English   中英

PHP只重定向根域

[英]PHP redirect only root domain

我需要一個PHP代碼只將我的索引頁重定向到另一個站點非常快這樣的東西,但問題是:此代碼重定向所有頁面

 <?php    
  header('Status: 301 Moved Permanently', false, 301);      
  header( 'Location: http://www.fastfreesurfing.cf/' ) ;      
  exit();      
?>

做這個:

if ($_SERVER['REQUEST_URI'] == '/' || strtolower($_SERVER['REQUEST_URI']) == '/index.php') {
    header('Status: 301 Moved Permanently', false, 301);      
    header( 'Location: http://www.fastfreesurfing.cf/' ) ;      
    exit();
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM