Changing the permanent redirect from 301 to 308, will the method of form submission be changed?
Change the permanent redirect from 301 to 308, will the method of form submission be changed? By definition, it will not - 308 explicitly requires the client to maintain the method and session body in the request after the redirect. While 301 also requires the same in the specification, the problem lies in the implementation: old clients may incorrectly switch to GET. The change of line does not bring a new semantics, but rather eliminates the 'bias of old implementation.'
The difference in specifications of two status codes
| Project | 301 | 308 |
|---|---|---|
| semantics | The resource has been permanently migrated to a new address | The resource has been permanently migrated to a new address |
| The specification requires the method and request body | Keep unchanged | Keep unchanged |
| Old client implementation | May be changed to GET | Should not be rewritten by definition |
| Applicable scenarios | Page address migration | Need to retain the interface or form endpoint of the method and request body |
| Caching nature | Can be cached for a long time | Can be cached for a long time |
The difference is focused on implementation compatibility. At the specification level, both have the same requirements, so the statement that '308 is more standardized than 301' is not accurate; the accurate statement is: 308 incorporates 'do not rewrite the method' into the definition of the status code itself, so the client cannot use it as the old habit of 'changing to GET'.
Why does the client implementation rewrite the method
The historical reason is the early handling habits of browsers: after receiving 301, the new address is requested again via GET. This has no effect on page redirection, but it will lose data for form submissions - the content submitted with an insecure method becomes a read-only operation after redirection. The introduction of 308 is to eliminate this kind of ambiguity.
For content sites, the most likely place to encounter this is not the ordinary article page, but three types of endpoints: form submission addresses, interface writing addresses, and third-party callbacks with request bodies. If redirection occurs at these three locations, it is worth checking whether the method has been rewritten.
What scenarios are worth changing to 308
The criterion for replacement is only one: whether the request after the jump still carries the original method and request body.
- The form or API endpoint has changed due to revision: use 308 to avoid the old client reading it once.
- Page address migration, users enter through links: both are available, but maintaining consistent tone across the entire site is more important.
- Third-party callback with request body: 308 is preferred, and a real test should be conducted after switching to see if the submission reaches the new address.
- Temporary maintenance: it does not belong to the scope of these two codes, and a status code indicating temporary unavailability should be used.
In reverse, changing all 301 to 308 at once yields limited profit. The behavior difference of the redirect chain only becomes apparent when there is a request body, and the change in the page browsing path only adds an additional verification cost.
Before changing the redirect, you must confirm the target form.
First confirm whether the new address is the final form. The most common mistake in the revision is 'jumping to an intermediate page, and then jumping to the intermediate page again'. With each level of the redirect chain, the reading cost and the certainty of position passing will become worse.
The form of the address within the site is determined by the pseudostatic rule, and the change of the rule will affect the output address of the list page and the detail page at the same time. It is recommended to follow these three steps before changing the redirect:
- Access a batch of real addresses (list pages, detail pages, addresses with pagination parameters) one by one under the new rules to confirm that the final address is returned instead of another redirect;
- Map the old addresses to new addresses into a set of rules to avoid individual allocation;
- Confirm whether the parameters are retained. Dropping query parameters in the redirect configuration is a common reason for the form and search address to fail.
After the redirection is configured, you still need to hand over the new address to the search side: The in-site link push is responsible for submitting the new and changed addresses to search engines to accelerate indexing. Redirection solves the problem of 'where the old address goes', and push solves the question of 'when the new address will be read', and only when both things are done can the revised information be considered to have been disseminated.
Cooperation between redirection link and push
If a revision changes the address format and site structure at the same time, it is recommended to execute in the order of 'first configure redirection, then verify return codes, and finally push in bulk.' Doing it the other way around will result in a window period: the new address is not yet stable, the old address has not yet pointed to the correct target, and the crawling party cannot read definite information from both ends.
Check three things when verifying the return code: whether the status code is the expected one, whether the Location points to the final address, and whether the same address returns consistently in multiple requests. Inconsistent return results are usually caused by rule priority or caching, which is more likely to cause problems than whether the method has been rewritten.
Common questions
Question: What should be done if the old client does not support 308?Answer: The semantics of 308 are the same as those of 301. If the implementation does not support it, you can handle it as a permanent redirect, and there is no situation where it cannot be recognized completely; the focus is still on endpoints with request bodies.
Question: Will changing to 308 affect the pages that have already been indexed?Answer: The position transfer depends on whether the jump is stable and whether the target is the final address, not on which permanent code is used.
Question: Should the jump rules be submitted to the search engine along with it?Answer: The new address list is submitted, and the jump rules themselves remain on the server and within the configuration, read by the crawling party during actual access.