SEO之如何做301转向

1、如果网站使用的是(Linux+Apache+MySQL+PHP)主机,可以使用.htaccess文件做301转向

比如把/index.html 301转向到http://www.xinlvtian.com,可以在.htaccess文件中放上这个指令

Redirect 301 /index.html http://www.xinlvtian.com

把所有不带www(http://xinlvtian.com)网址301转到带www的网址,包括把http://xinlvtian.com/about.html转到http://www.xinlvtian.com/about.html

2、如果用的是Windows主机

Asp代码:
<% @ language=vbscript %>
<% Response .status =”301 moved permanently” response.addheader “location”,”http:www.xinlvtian.com” >

php代码:

Header(“http/1.1 301 moved permanently”);
Hrader(“location:http://www.xinlvtian.com”);
?>

原文地址:https://www.cnblogs.com/xinlvtian/p/8945564.html