301重定向是什么意思(301跳转怎么做怎么设置)

- 作者:小小课堂网 - 阅 2,471   推荐

301重定向是什么意思?301重定向就是一个链接到另外一个链接的永久性跳转。今天,小小课堂网( xxkt.org.cn )为大家带来的是《301重定向是什么意思(301跳转怎么做怎么设置)》。希望对大家有所帮助。

一、什么是301重定向

301,是常见HTTP状态。

HTTP状态码,是用户请求访问某网址,服务器返回的数字。

301是指用户请求某网址,却永久地跳转到了另外的一个网址上,此时服务器返回的状态码为301,故称为301重定向为永久性跳转。

二、301重定向的形式有几种

301重定向有两种形式,一种是单页面301转向,另外一种是全站转向。

1)单页面301重定向

一个链接永久性地跳转到另外的一个链接。

如首页的网址不规范,有两个主页的链接,可以将其中一个跳转至另外一个。

如:xxkt.org跳转至xxkt.org.cn

2)全站301重定向

网站全部链接需要按照一定的规则跳转到新的链接上。常见的有两种形式,第一种网站换域名,第二种HTTP到HTTPS。

如:http://xxkt.org.cn 到 https://xxkt.org.cn

三、网站301重定向怎么做

 

1、Windows服务器修改web.config来实现301跳转

1)web.config单页面跳转的web.config如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>

<rule name="Redirect(命名)" stopProcessing="true">
<match url="^(要重定向的页面)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="(重定向到的页面)" />

</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

2)多个页面跳转链接如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>

<rule name="Redirect" stopProcessing="true">
<match url="^abc/001.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://" />

<rule name="Redirect2" stopProcessing="true">
<match url="^abc/002.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://" />

</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

多个页面跳转时,rule name 不能相同。

3)全站跳转301跳转如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WWW Redirect" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^需要转的域名$" />
</conditions>
<action type="Redirect" url="http://要转到的域名/{R:0}"
redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

很多时候,web.config文件已经有规则了,记得不要删除,直接增加规则即可。如下图所示:

整合后的代码

2、Linux服务器一般为修改.htaccess来实现301跳转

1)单页面如将网页index.php重定向到http://www./index.php?go=category_6 如下:

redirect permanent /index.php http://www/index.php?go=category_6

2)全站301重定向如下:

RewriteEngine On

RewriteCond %{HTTP_HOST} !^xxkt.org.cn$ [NC]

RewriteRule ^(.*)$ http://xxkt.org.cn/$1 [L,R=301]

四、301重定向有什么好处

301重定向不仅可以优化SEO权重,又可以提升用户体验度。

1、权重不流失

SEO优化技术为了防止不规范网址或网站改版造成的权重流失,301重定向可以传递权重。也就是将原来的网址跳转到另外一个网址,让权重传递下去。

2、增强用户体验度

将死链接跳转到正确的链接上,可以让用户看到想看到的内容。

以上就是小小课堂网( xxkt.org.cn )为大家带来的是《301重定向是什么意思(301跳转怎么做怎么设置)》。感谢您的阅读。小小课堂网SEO基础教程。优化培训认准小小课堂!

本文最后一次更新时间:2022年2月28日

本文《301重定向是什么意思(301跳转怎么做怎么设置)》由小小课堂网整理或原创,侵删,欢迎转载并保留版权:https://xxkt.org.cn/ 感谢您的阅读。

本站提供SEO培训、咨询、诊断,QQ:2216876660 微信:huowuyan 公众号:小小课堂网

标签:

相关文章!
error: Content is protected !!