*For updates on 308 redirects and the time to save redirects, see p. 1.1 and 4, respectively.
It is important to configure the correct server responses during the internal optimization of your website. Search engines regularly interact with the website: crawl pages, make changes to the index, rank. The goal of your online business is to provide correct information about the work of the entire resource in order to get more points when ranking.
You need to check what response codes the server is sending and whether page redirects are configured correctly to do this. Since the search robots initially turn to the server, and only after that – to the pages of the website. When the server responses are configured correctly, search engines do not need to re-check the entire website when crawling – it only indexes the changed or new ones. This is how robots save resources.
Page redirect in simple terms – redirecting the search robot and the user to a page that they did not request initially. This often happens when the url of some page was changed, then they set up a redirect using redirects in order for the user to get to the desired one.
Example:
Fig. 1 – Sample server response (response contains HTTP status code and Expires header)
Let’s figure out what response codes are exist and how to redirect the page.
If you are transferring a website to the https protocol or to a version of the website without www, or moving to a new domain, then redirects are the first thing you need to set up.
Consider the most important and demanded classes of page state and outline the details of work.
The query has several possible answers and the user must choose one of it.
Since there are no standard response codes, this redirect is rarely used.
Indicates that the site has permanently changed the address and further website requesting should be redirected to the new URL. The weight of pages from the old one is transferred to the new one.
Fig. 2 — Example for redirects 301
Code for temporary redirects. Search engines don’t update their links to the website, but the browser redirects users to the new page.
Disadvantages of 302 redirects:
As a result, when linking, the website loses the weight not only of the internal pages, but also of the external link mass.
Similar to code 302, but 303 does not indicate a movement of the requested URL.
A 303 redirect shows that there is no suitable URL for the requested page, but there are several URLs that conditionally satisfy the request.
Indicates that there is no need to resend the requested address if the page has not been modified since the last transfer. The browser will redirect the user to the saved copy of the page.
And if there were changes, then the answer is "200 OK".
Forwarding through a proxy server.
The 305 code is used for anonymity, or to speed up page loading (then the content is cached).
But not all browsers handle this response code correctly (for Explorer and Mozilla). Therefore, it is not used often.
Used to indicate the use of a specific proxy.
The code is not used now, but remains for reserve.
Used to refine 302 redirects.
Response 307 indicates that the site is available at a different URL, but will return to the previous URL shortly.
Like 302, 307 redirects are used for temporary redirects. The difference is that on a 307 redirect, the page response code ensures that the method and body remain unchanged.
Analog of 301 code, transfers the weight to the page. But with a limitation – it does not allow changing the request method from Post to Get.
308 redirect uses Google Drive – shows the Client that the download of data was interrupted.
Code 301 of the page’s response is believed to convey most of the link weight. Therefore, 301 redirects (permanent redirection to a new address) are used more often.
Upd. 12.07.2021 Google has officially confirmed that a 308 redirect is treated as 301. Literally: "status codes 301 and 308 mean that the page has moved to a new location forever" (source).
How to check if the transfer of a 301 redirect is correct?
Checking redirects can take up to 3 weeks, be prepared for this – search engines must bypass redirected pages and assign weight to new ones.
What you need to consider when affixing:
The results of site crawling will show most of the errors associated with redirects.
It should not be that part of the URL with a slash, and part without it. Ensuring consistency.
There must also be a 301st redirect from a URL with a slash to a URL without a slash (or vice versa – depending on the option chosen).
Example: https://site.com/razdel////tovar should redirect to a normal url https://site.com/razdel/tovar
Example: https://site.com/razdel12 to https://site.com/razdel
Example: https://site.com/razdel/ToVar на https://site.com/razdel/tovar
Fig. 3 — Example URL redirection
If it is not possible to correctly determine where to redirect the user, we recommend setting up the processing of such a rule:
Main/block1/blockn/
If there is an error in block n, and you did not find its match with any of the previous points, redirect using the 301st code to the n-1 nesting page up to the Main.
Things to consider:
Recommendation:
What services uses to search for "broken" links?
Broken links found, what’s next?
Fig. 4 — Example 404 server response
1. create a custom 404 permanent page like https://site.com/404;
2. check if she gives the 404th response code accurately (the 200th response is often set up by mistake);
3. we send all 404 pages to it, for example — https://site.com/folfdsfods
4. page https://site.com/404 contents:
That is, there should be links to popular sections or the main menu.
5. with the help of crawlers, we identify and eliminate the causes of 404x so-called “broken” links;
6. so that data about missing or error pages is reflected in Google Analytics reports:
Now the collected data can be viewed in the Content (Top pages, Top landing pages, Top exit pages) section of the Google Analytics report.
Information on "bad" 404 pages will show the volume of “broken” links. So we can safely remove or change them. Moreover, they will have to be removed from the index as well. We do this through the Google and Yandex panels. We formalize it with a 404 error to delete the broken page. The next time it crawls, the robot will execute deletion requests and they will disappear from Search.
404 Soft appears when the server should respond with a 404 (page does not exist), but responds with 200 OK.
This may be a product card with products that are no longer in production, i.e. the product will definitely not be in stock.
If in this case we register a redirect to a product category in order to transfer weight, then Google, due to the dissimilarity of page parameters, will perceive this as a Soft 404 error (Google defines them as “soft error pages”).
The same problem can occur when batch redirecting a large number of pages to one.
All 404 Soft errors need to be found and fixed to 404.
Where can you find all server response processing errors? In file logs.
This is an additional tool for correcting problems with internal website optimization.
Analogue of 404 error. The response code notifies that the page has been removed and is no longer available. During the subsequent check, the bot will not bypass it and make changes to the index.
Convenience of 410 redirects in notifying search robots that the page has been deleted correctly and can definitely be excluded from the index.
The text file access.log collects site statistics – all calls to the server of search robots.
What this list of URLs gives:
In addition, it can be “black SEO” from competitors (generated duplicates to deteriorate promotion).
Headers — exchange commands between the server and the search robot.
Headers contain information about the protocol, encoding, language and other components of the website.
Stores information about the date the page was last edited.
Mechanism of action:
Last-Modified header is good for speeding up indexing of multi-page websites.
Simply put, if the website has changed 5 pages out of 100, then the scanner does not need to bypass all 100. The spider will first index pages with the title Last-Modified, and after that – all the others, if it fits within the limited time allotted for crawling 1 website.
Indicates whether the page has been modified after the date that was received in Last-Modified.
Mechanism:
Stores a timestamp after which the server response is considered obsolete.
Expire date is needed to cache the contents of URLs so that these URLs are not loaded again on next calls to the server.
Or, if the content is static, it is equal to the moment the page was requested and the date the file was created.
In total, the server status codes make it clear to search bots how to work with the page, The robot either skips the content by responses and headers (since the page has not changed since its last crawl), or enters the index, or returns to it later.
1. If you are running an Apache web server, the easiest way to set up a redirect is through the .htaccess file.
WordPress
.htaccess file is located in the root folder of the site. To do this, go to the hosting control panel: Files – File manager. Or, if you are using cPanel, then File Manager – Files. Or you can connect via FTP.
For OpenCart, you need to write the code:
RewriteCond %{QUERY_STRING} ^_route_=address_old_page.html$
RewriteRule ^(.*)$ https://your_domain.ua/new_page/? [R=301,L]
Bitrix
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.itforce.ua$ [NC]
RewriteRule ^(.*)$ https://itforce.ua/$1 [R=301,L]
Joomla
Configuration takes place through the admin panel in the Components – Redirection section.
Here you can also track pages with broken links and immediately set up redirection to the correct pages.
2. The second way – plugins for CMS.
For WordPress:
We go to the admin panel, then Tools – Redirection.
Fig. 5 — Adding new
Fig. 6 — Editing old
OpenCart
There is a ready-made paid module "301 redirect manager".
Bitrix
There are several paid modules: Redirect master, Redirect links, Redirector, etc.
Joomla
This CMS has a built-in component “Components – Redirection”.
Pages that are promoted should give a 200 response code.
Relocated — 301.
And 404 — all pages with errors.
Each code must match the assigned task. This is how search robots work more efficiently with website pages.
Upd. 26.07.2021. About saving redirects – Twitter post from Google employee Harry Ilsh:
hands up if you asked us recently for how long you should keep redirects in place!
i have a concrete answer now: at least 1 year.
(but try keeping them indefinitely if you can for your users).
— Gary 鯨理/경리 Illyes (@methode) July 21, 2021
According to SEO, it is advisable to leave redirects for at least a year. This will help ensure that all signals are constantly being transmitted to the new URL. However, even if you decide to delete them after a year, it is advisable for users to keep redirects forever (this is not a year from the moment of creation, but from the moment of their first Google crawl).
Hopefully now you won’t have any problems configuring the answers.
Ask questions in the comments if there is any misunderstanding. Our specialists will be happy to answer it.