A Technical SEO Guide to Redirects
A Technical SEO Guide to Redirects. Websites change structure, delete pages and often move from one domain to another. Handling redirects correctly is crucial in order to avoid losing rankings and help search engines understand the changes you have done.
Redirects have a status code starting with number three (i.e., 3XX). There are 100 different possible status codes but only a few are implemented to carry certain information.
In this guide, we will cover 3XX redirects relevant to SEO.
301: Moved Permanently
This well-known redirect indicates to a client* that the resource was changed to another location and that it should use the new URL for future requests. When search engines see a 301 redirect, they pass the old page’s ranking to the new one.
Before making a change, you need to be careful when deciding to use a 301 redirect. This is because if you change your mind later and decide to remove the 301 redirect, your old URL may not rank anymore.
Even if you swap the redirects, it will not help you get the old page back to its previous ranking position. So the main thing to remember is that there’s no way to undo a 301 redirect.
(*For beginners who may get confused with generic name client is used instead of browser since not only browsers are able to browse URLs but also search engine bots which are not browsers.)
307: Temporary Redirect
In HTTP 1.1, a 301 redirect means the resource is temporarily moved and the client should use the original resource’s URL for future requests.
For SEO, this means the client should follow a redirect but search engines should not update their links in the SERPs to the new, temporary page.
In a 307 redirect, PageRank is not passed from the original resource to the new one – contrary to a 301 redirect.
302: Found
This means that the resource a client is looking for was found on another URL in the HTTP 1.1 version but was temporarily moved in HTTP 1.0.
302 vs. 307
In almost all cases, 302 and 307 redirects will be treated the same. But a 302 status code doesn’t necessarily mean the client must follow a redirect and it is not considered an error if it decides to stay there.
Modern clients will most likely follow the new destination but some old clients may incorrectly stay on the same URL.
Contrary to a 302 status code, the 307 status code guarantees that the request method will not be changed. For instance, the GET request must continue to GET and POST to POST.
With a 302 status code, some old or buggy clients may change the method which may cause unexpected behavior.
For temporary redirects, you can use either 302 or 307 – but I do prefer 307.
For routine redirect tasks, 301 (permanent redirect) and 307 (temporarily redirect) status codes should be used depending on what type of change you are implementing on your website. In both cases, the syntax of redirects doesn’t change.
You may handle redirect via server config files .htaccess on Apache, example.conf file on Nginx, or via plugins if you are using WordPress.
In all instances, they have the same syntax for writing redirect rules. They differ only with commands used in configuration files. For example, redirect on Apache will look like this:
Options +FollowSymlinks RewriteEngine on RedirectMatch 301 ^/oldfolder/ /newfolder/
(You can read about symlinks here ).
On Nginx servers, it will look like:
rewrite ^/oldfolder/ /newfolder/ permanent;
The commands used to tell servers status code of redirect and the action command differ. For instance:
- Servers status code of redirect: “301″ vs. “permanent”
- Action command: “RedirectMatch” vs. “rewrite”.
Read more: https://www.searchenginejournal.com/technical-seo/redirects/#close