wang_rx 发表于 2018-12-11 11:32:14

php用header函数实现301跳转代码实例

$the_host = $_SERVER['HTTP_HOST'];  $request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
  if($the_host !== 'www.iyunv.net')
  {
  //echo $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
  header('HTTP/1.1 301 Moved Permanently');
  header('Location: //www.iyunv.net' . $_SERVER['PHP_SELF']. $request_uri);
  }

页: [1]
查看完整版本: php用header函数实现301跳转代码实例