入驻爱江湖,客户增长翻一翻>>>    优化方案    城市列表 网站地图    TAG标签   

当前位置: 首页>>网站SEO优化

HTTP重定向:永久301与临时302对SEO的影响

发布时间:2022-04-06 17:44:18
浏览:47 作者:admin

一、HTTP重定向属于两类:临时302或永久301。

使用永久重定向作为网站重定向重要信号,表明目标URL应该是搜索结果中显示的URL。


相反,使用临时重定向302作为重定向目标应该是搜索结果中显示的URL的较差信号。


百度的帮助页面中添加了有关以下六种重定向类型的完整详细信息:


1、永久服务器端重定向:更改搜索结果中页面显示的URL的最佳方式。百度建议尽可能使用这种类型。301和308状态代码表示页面已永久移动到新位置。


2、临时服务器端重定向:临时将访问者发送到新页面,同时确保百度在其结果中保留旧URL更长的时间。


3、即时刷新重定向:百度搜索将即时刷新重定向解释为永久重定向。


4、延迟刷新重定向:百度搜索将延迟刷新重定向解释为临时重定向。


5、JavaScript位置重定向:一旦完成对URL的抓取,百度搜索就会使用Web呈现服务解释并执行JavaScript。


6、加密重定向:这涉及添加指向新页面的链接,并附有简短的说明。这有助于用户找到您的新页面,百度可能会将其理解为加密重定向。


选择重定向取决于您期望重定向的时间以及您希望百度搜索在搜索结果中显示的页面。如果您有可能希望在搜索结果中再次显示某个特定网址,请不要将其永久重定向到另一个网址。


始终尽可能进行服务器端重定向。仅当您无法进行服务器端或元刷新重定向时才使用JavaScript重定向。不要依赖加密重定向让搜索引擎知道您的内容已经移动,除非您别无选择。

WWW_副本.jpg

二、301和302重定向,会如何影响SEO吗?

①301重定向,主要是指从A完全跳转到B,在这个过程中,A页面的所有权限,都完全传递给B页面,甚至是A页面的惩罚,使用不当也会传递。


②302重定向,主要是只因为一些临时事件的发生,我们短期内,从A页面,占时跳转到B页面展示,等到事情完结之后,我们仍然会采用A页面。


这就是301与302重定向最大的区别。


通常,我们采用重定向的场景,主要包括:


①网址已损坏或无效,成为死链接。


②该网页/站点不再有效,已经选择自动关闭。


③您有一个新的网页/站点,希望人们访问,而不是旧的。


④您正在A/B测试新网页的设计或功能。


⑤您正在修复网页,但想暂时绕道,以获取持续的网站体验。


关于重定向常见的相关性问题:


1、什么时候可以安全删除重定向和旧网页?


答:如果你的网站一直在运营,经过重定向后,你可以选择长期保持对应规则的配置,当然,当你采用301的时候,如果对方权重已经完全替换,你也可以删除重定向。


如果你的网站选择性的关闭,那自然不用多说。


2、重定向的时间周期是有多久?


答:301重定向,如果是中小网站,它的时间周期是相对比较长的,甚至高达1-2两个月之久,才能完全的转移页面所有的权限。


而在这个过程中,可能还存在一定的损耗,而对于302重定向它是即时的。


3、多域名重定向到一个新域名好吗?


答:多个域名重定向到一个新域名,对方的权重是可以叠加到目标新域名的,但从SEO的角度来讲,这明显是一个作弊行为。


搜索引擎并不喜欢网站运营者,采用作弊的形式操作SEO。


4、重定向会失败吗,它的后果很严重吗?


答:重定向是存在失败的可能的,特别是301重定向,如果你操作不当,会严重影响新老两个域名的权重。


三、HTTP 301-308含义解释

301永久重定向


301重定向是指示链接的目标已永久将URL更改为不同的URL,例如,当seoexample更名为example时,他们将URL从seoexample.com更改为example.com,每个seoexample.com页面都通过永久的301重定向重定向到相应的example.com页面。


302临时重定向


在实际的HTTP规范中,302旨在简单地表明预期的URL不是给定资源的正确URL,然而,大多数网络系统都以这种方式实现了临时重定向,因此它通常被用作301的临时版本。


为了区分原始302的两个预期特征,HTTP代码标准的管理机构实施了303和307代码,实际上,这两种都不常用,302仍然可以作为临时重定向。


303,原始302的预期功能


当浏览器进行PUT调用并通过GET响应接收到不同的URL时,它使用的是303协议,如果你熟悉该技术标准,你几乎可以忽略这一点,因为这与搜索引擎优化完全无关。


304未修改


用于数据缓存的代码,如果服务器在过去提取了页面的数据,并且客户端请求该页面,则服务器将检查该页面是否已更改,如果页面以304响应,则表示服务器已经具有该页面的最新版本,然后,服务器可以提供它已有的内容,而无需重新运行代码,重新获取资产或重新生成页面。


305使用代理


此代码是一种奇怪的传统措施,服务器用它告诉客户端它只能通过指定的代理访问服务器,它曾经被滥用,随后被浏览器忽略,基本上已被放弃,类似地,306代码指定客户端应该使用特定代理,并且不再使用。


307临时重定向


当浏览器向服务器请求URL 1时,但URL已暂时更改,服务器将使用307和新的URL 2进行响应,但是,由于它是临时重定向,因此浏览器将不存储此信息,当浏览器下次请求URL 1时,服务器将再次检查并查看重定向是否已被删除。


308永久重定向


这意味着要成为301重定向的一个更现代,更流畅的版本,当浏览器向服务器请求URL 1时,服务器说“实际上,它现在是URL 2”。然后,流量将正常进行到URL 2,而不用更改HTTP的方法; 这允许通过表单提交进行数据传输而不会发生问题,例如,重定向失败,在所有这些中,你只需关心 301,302,307和308。


四、HTTP请求GET和POST

为了理解在任何特定时间应使用哪种重定向,您需要了解一些关于HTTP如何工作的信息。


GET和POST都是浏览器或客户端与服务器通信的方法,简而言之,GET就是浏览器向服务器请求特定数据,POST将数据提交给要处理的服务器。


GET请求可以被缓存,它们保留在浏览器历史记录中,可以添加书签,并专门用于检索数据,“抓住这个URL上的内容”本质上是一个GET请求。


POST请求更像是要由服务器处理的脚本,您是否曾经使用过一种基于网络的搜索表单,当您点击“返回”按钮或尝试刷新页面时,抛出“您需要重新提交数据到表单”警告?这是因为它是一个POST请求,POST请求不会被缓存,不会保留在浏览器历史记录中,也不能被添加书签,因为它们或多或少是一组到服务器的命令,而不是静态资源的请求。


301重定向和308重定向的核心主要区别在于308重定向不允许从POST 更改为GET,302和307也是如此; 307是不允许改变的。


如果您的网址为1的表单提取了来自网址2的数据,并且您将网址2更改为网址3,则表单将会中断而不执行特定操作,在这种情况下,使用更高编号的重定向307或308将很重要。


在绝大多数情况下,特别是当你只关注SEO时,你只需使用301永久重定向或者302临时重定向。


如果您在搜索引擎优化是您的主要关注点时是否应该使用307或308重定向?一般来说,答案是否定的,307和308都是HTTP 1.1标准,虽然这些更新更高效,但它们并不一定在服务器,浏览器或搜索引擎中得到广泛支持,在被广泛采用之前,最好将重定向保留为301或302。


四、301和302你应该使用哪个?

如上所述,301重定向是永久重定向,302是临时重定向,你应该使用哪一个,什么时候?


302重定向被视为临时更改,不会被缓存或保存,实质上,302重定向不被搜索引擎认为是重要的,如果他们抓取您的网站,他们会使用它,但他们会认为原始链接是真正的链接。


在某些情况下,302重定向可能很有价值,它们可用于地理定位,分割测试,某些形式的用户跟踪以及意图为临时的重定向,例如,在维护站点期间更改URL以便内容仍然可用于其他URL,可以使用302来完成。


302重定向不会传递页面权重或将旧URL链接到新URL,如果您要将站点的URL从一个更改为另一个,则不需要使用302重定向,这样做基本上会将所有网站价值留在旧网址上。


在某些情况下,搜索引擎会将302认为是301,并且新网站应具有旧网站的价值。但是,如果发生这种情况,这很可能需要一些时间,并且与永久重定向相比,它们可能会给您带来更少的价值,您实质上是在向百度表示您不知道如何正确迁移某个网站,并且他们会在记入您的同时记住这一点,使用302重定向时,您将失去大部分的页面权重传递。


如上所述,301重定向是永久性的,如果您正在从一个网址迁移到另一个网站,合并两个网站,或者更改不希望被还原的网址,则可以使用301重定向。


301重定向旨在通知浏览器和搜索引擎从一个URL移动到另一个URL,就像在你搬家时没有更改快递地址,你的快递可能会产生配送失败等不可抗因素。


一般来说,301是永久性的,如果你想将页面权重传递到新URL,请使用301,如果需要临时改变URL,则可以使用302 ,但他不会转移页面权重。


301重定向是永久的,百度识别301需要多久?你应该保持重定向多久?


这可能是半年,或者比半年更长,这样我们才能真正确定指向旧网址的所有内容都指向新网址。”


长期保持重定向对于百度确保他们已正确编制索引并将有关旧页面的所有内容重定向到新页面非常重要,对于拥有旧页面书签的用户来说,更改他们的书签也很重要,当你删除重定向,并有人试图访问旧页面,将会产生404。



英文翻译对照:


HTTP redirection: the impact of permanent 301 and temporary 302 on SEO

1、 HTTP redirection falls into two categories: temporary 302 or permanent 301.

Use permanent redirection as an important signal of website redirection, indicating that the target URL should be the URL displayed in the search results.

Instead, using temporary redirection 302 as a redirection target should be a poor signal of the URL displayed in the search results.

Baidu's help page adds complete details about the following six redirection types:

1. Persistent server-side redirection: the best way to change the URL displayed on the page in search results. Baidu suggests using this type as much as possible. 301 and 308 status codes indicate that the page has been permanently moved to a new location.

2. Temporary server-side redirection: temporarily send visitors to the new page, while ensuring that Baidu retains the old URL in its results for a longer time.

3. Instant refresh redirection: Baidu search interprets instant refresh redirection as permanent redirection.

4. Delayed refresh redirection: Baidu search interprets delayed refresh redirection as temporary redirection.

5. JavaScript location redirection: once the URL is captured, Baidu search will use the web rendering service to interpret and execute JavaScript.

6. Encrypted redirection: this involves adding a link to a new page with a short description. This helps users find your new page, which Baidu may interpret as encrypted redirection.

The choice of redirection depends on the time you expect to redirect and the page you want Baidu search to display in the search results. If you might want a particular URL to appear again in search results, do not permanently redirect it to another URL.

Always perform server-side redirection whenever possible. Use JavaScript redirection only if you cannot perform server-side or meta refresh redirection. Don't rely on encrypted redirection to let search engines know that your content has moved unless you have no choice.

2、 How will 301 and 302 redirection affect SEO?

① 301 redirection mainly refers to the complete jump from a to B. in this process, all permissions of page a are completely passed to page B, and even the punishment of page a will be passed if it is not used properly.

② 302 redirection is mainly due to the occurrence of some temporary events. In a short time, we will jump from page a to page B. after the event is over, we will still use page a.

This is the biggest difference between 301 and 302 redirection.

Generally, we use redirection scenarios, mainly including:

① The URL is damaged or invalid and becomes a dead link.

② The page / site is no longer valid and has chosen to close automatically.

③ You have a new page / site that you want people to visit, not the old one.

④ You are a / B testing the design or functionality of a new web page.

⑤ You are repairing the web page, but you want to make a temporary detour for a continuous website experience.

Common relevance questions about redirection:

1. When can I safely delete redirects and old web pages?

A: if your website has been in operation, you can choose to maintain the configuration of the corresponding rules for a long time after resetting. Of course, when you use 301, if the other party's weight has been completely replaced, you can also delete the redirection.

If your website is selectively closed, it's needless to say.

2. How long is the time period for redirection?

A: 301 redirection, if it is a small and medium-sized website, its time cycle is relatively long, even as long as 1-2 months, in order to completely transfer all the permissions of the page.

In this process, there may be some loss, and it is instant for 302 redirection.

3. How about redirecting multiple domain names to a new domain name?

A: when multiple domain names are redirected to a new domain name, the other party's weight can be superimposed on the target new domain name, but from the perspective of SEO, this is obviously a cheating behavior.

Search engines do not like website operators to operate SEO in the form of cheating.

4. Will redirection fail? Will the consequences be serious?

A: redirection may fail, especially 301 redirection. If you operate improperly, it will seriously affect the weight of the new and old domain names.

3、 Http 301-308 interpretation

301 permanent redirection

301 redirection indicates that the target of the link has permanently changed the URL to a different URL. For example, when seoexample is renamed example, they change the URL from seoexample Com to example COM, each seoexample Com pages are redirected to the corresponding example through permanent 301 redirection Com page.

302 temporary redirection

In the actual HTTP specification, 302 is intended to simply indicate that the expected URL is not the correct URL for a given resource. However, most network systems implement temporary redirection in this way, so it is usually used as a temporary version of 301.

In order to distinguish the two expected features of the original 302, the management organization of the HTTP code standard implements 303 and 307 codes. In fact, these two codes are not commonly used, and 302 can still be used as a temporary redirect.

303, expected function of original 302

When the browser makes a put call and receives different URLs through a get response, it uses the 303 protocol. If you are familiar with the technical standard, you can almost ignore this, because it has nothing to do with search engine optimization.

304 not modified

Code for data caching. If the server has extracted the data of the page in the past and the client requests the page, the server will check whether the page has changed. If the page responds with 304, it means that the server has the latest version of the page. Then, the server can provide its existing content without re running the code, re acquiring assets or regenerating the page.

305 using agents

This code is a strange traditional measure. The server uses it to tell the client that it can only access the server through the specified proxy. It has been abused, ignored by the browser and basically abandoned. Similarly, 306 code specifies that the client should use the specific proxy and no longer use it.

307 temporary redirection

When the browser requests URL 1 from the server, but the URL has been temporarily changed, the server will respond with 307 and the new URL 2. However, since it is a temporary redirection, the browser will not store this information. The next time the browser requests URL 1, the server will check again and see whether the redirection has been deleted.

308 permanent redirection

This means becoming a more modern and smoother version of 301 redirection. When the browser requests URL 1 from the server, the server says "actually, it is now URL 2". Then, the traffic will normally proceed to URL 2 without changing the HTTP method; This allows data transfer through form submission without problems, such as redirection failure, of which you only need to care about 301302307 and 308.

4、 HTTP request get and post

To understand which redirection should be used at any given time, you need to know something about how HTTP works.

Both get and post are methods for the browser or client to communicate with the server. In short, get is that the browser requests specific data from the server, and post submits the data to the server to be processed.

Get requests can be cached, kept in the browser history, bookmarked, and specifically used to retrieve data. "Grab the content of this URL" is essentially a get request.

Post requests are more like scripts to be processed by the server. Have you ever used a web-based search form that throws a warning "you need to resubmit data to the form" when you click the "back" button or try to refresh the page? This is because it is a post request. Post requests will not be cached, retained in the browser history, or bookmarked, because they are more or less a set of commands to the server rather than requests for static resources.

The core difference between 301 redirection and 308 redirection is that 308 redirection does not allow changing from post to get, and so do 302 and 307; 307 is not allowed to change.

If your form with web address 1 extracts data from web address 2 and you change web address 2 to web address 3, the form will be interrupted without performing specific actions. In this case, it is important to use a higher numbered redirect 307 or 308.

In most cases, especially when you only focus on SEO, you only need to use 301 permanent redirection or 302 temporary redirection.

Should you use 307 or 308 redirection when SEO is your main concern? Generally speaking, the answer is No. 307 and 308 are HTTP 1.1 standards. Although these updates are more efficient, they are not necessarily widely supported in servers, browsers or search engines. Before they are widely adopted, it is best to retain redirection as 301 or 302.

4、 301 and 302 which should you use?

As mentioned above, 301 redirection is permanent redirection and 302 is temporary redirection. Which one should you use and when?

302 redirection is regarded as a temporary change and will not be cached or saved. In essence, 302 redirection is not considered important by search engines. If they grab your website, they will use it, but they will think that the original link is a real link.

In some cases, 302 redirects can be valuable for geolocation, segmentation testing, some forms of user tracking, and redirects intended to be temporary, such as changing URLs during site maintenance so that content is still available for other URLs, which can be done using 302.

302 redirection does not pass the page weight or link the old URL to the new URL. If you want to change the URL of the site from one to another, you don't need to use 302 redirection. Doing so will basically leave all the website value on the old URL.

In some cases, the search engine will consider 302 as 301, and the new website should have the value of the old website. However, if this happens, it is likely to take some time, and compared with permanent redirection, they may bring you less value. You are essentially telling Baidu that you don't know how to migrate a website correctly, and they will remember this while recording you. When using 302 redirection, you will lose most of the page weight transfer.

As mentioned above, 301 redirection is permanent. If you are migrating from one website to another, merging two websites, or changing the website you don't want to restore, you can use 301 redirection.

301 redirection is designed to inform browsers and search engines to move from one URL to another. Just like you didn't change the express address when you moved, your express may cause irresistible factors such as delivery failure.

Generally speaking, 301 is permanent. If you want to transfer the page weight to a new URL, please use 301. If you need to change the URL temporarily, you can use 302, but it will not transfer the page weight.

301 redirection is permanent. How long does it take Baidu to identify 301? How long should you stay redirected?

This may be half a year or longer, so that we can really make sure that all content pointing to the old website points to the new website. "

Keeping redirection for a long time is very important for Baidu to ensure that they have correctly indexed and redirected all the content about the old page to the new page. For users with bookmarks on the old page, it is also important to change their bookmarks. When you delete the redirection and someone tries to visit the old page, 404 will be generated.

分享按钮