//如果域名是不带www的网址那么进行下面的301跳转
$the_host = $_SERVER[‘HTTP_HOST’];
t h e u r l = i s s e t ( the_url = isset(theurl=isset(_SERVER[‘REQUEST_URI’]) ? S E R V E R [ ′ R E Q U E S T U R I ′ ] : ′ ′ ; i f ( s t r p o s ( _SERVER['REQUEST_URI'] : ''; if(strpos(SERVER[′REQUESTURI′]:′′;if(strpos(the_host,‘www.’)===false)
{
header(‘HTTP/1.1 301 Moved Permanently’);
header(‘Location:http://www.’.t h e h o s t . the_host.thehost.the_url);
exit();
}
版权声明:本文为wbryze原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。