thinkphp 301转向

admin
2012-07-26 / 0 评论 / 352 阅读 / 正在检测是否收录...

PHP设置301重定向方法
一,直接使用内置函数header
header( "Location: http://www.8shop.org", true, 301);

二,使用HTTP/1.x声明301重定向

header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: http://www.8shop.org" );

 

需要注意的是地址部分要求是完整的url 。http://www.8shop.org 是正确的 www.8shop.org是错误的。

thinkphp的301 也是一样的,直接在代码里写header 就行了。毫无差别哦。

0

评论 (0)

取消