Переадресация URL - как лучше для SEO
What is a URL Redirect?
A redirect is an event used for sending website visitors and search engines to a different URL address (in other words, a web page). For example, when you attempt to access page A, you are being redirected to the page B. During such event a web server sends a response code to your browser or a search engine. The most common redirects used are 301 and 302.
- 301, "301 Moved Permanently"
- 302, "302 Found (Previously "Moved temporarily")"
- 300, "300 Multiple Choices"
- 303, "303 See Other"
- 304, "304 Not Modified"
- 305, "305 Use Proxy"
- 307, "307 Temporary Redirect"
- 308, "308 Permanent Redirect"
301 Moved Permanently
This and all future requests should be directed to the given URI
302 Found (Previously "Moved Temporarily")
Tells the client to look at (browse to) another URL. 302 has been superseded by 303 and 307. This is an example of industry practice contradicting the standard. The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect (the original describing phrase was "Moved Temporarily"), but popular browsers implemented 302 with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307 to distinguish between the two behaviors. However, some Web applications and frameworks use the 302 status code as if it were the 303.
300 Multiple Choices
Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation). For example, this code could be used to present multiple video format options, to list files with different filename extensions, or to suggest word-sense disambiguation.
303 See Other
The response to the request can be found under another URI using the GET method. When received in response to a POST (or PUT/DELETE), the client should presume that the server has received the data and should issue a new GET request to the given URI.
304 Not Modified
Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match. In this case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.
305 Use Proxy
The requested resource is available only through a proxy, the address for which is provided in the response. Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons
307 Temporary Redirect
In this case, the request should be repeated with another URI; however, future requests should still use the original URI. In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request. For example, a POST request should be repeated using another POST request.
308 Permanent Redirect
The request and all future requests should be repeated using another URI. 307 and 308 parallel the behaviors of 302 and 301 but do not allow the HTTP method to change. So, for example, submitting a form to a permanently redirected resource may continue smoothly.
How to redirect user
Redirect using PHP
Sending header refresh. Syntax: refresh in seconds, target URL for landing
<?php header( "refresh:5;url=https://llamasapps.com/blog/url-redirection-for-seo/" );
Using header location sytax:
<?php header("Location: https://llamasapps.com/blog/url-redirection-for-seo/");
Syntax: window.location.href = target URL for landing
Redirect using HTML meta tag
Add this line to < header >
<meta http-equiv="refresh" content="5;url=https://llamasapps.com/blog/url-redirection-for-seo/">
SEO Best Practises
It's very easy to negate all the great SEO work you have been doing on your WordPress website by forgetting to take care of old page redirection in case it has been moved or deleted.
The good news is that it's very easy to sort out. Let's dive into theory first, and then explore a few solutions that could work for your WordPress website.
Whenever you change web address of a page or want to delete an old one you need to make sure all the SEO value of that page is transferred from it to a new page or, in case of a deletion, to your domain in general.
There are multiple ways of dealing with this, however, the 301 redirect is preferable for both search engines and users. When using a 301 redirect, both browsers and search engine bots understand that the page has moved permanently. In this instance. search engines will understand that not only the page has changed location, but that content can be found at the new web address. All the link equity from the original page will go to the new one and there will be no loss of gained rankings.
Something to bear in mind, the search engine bots will take their time before they discover the changes, process it and pass on all the SEO goodness to the new page. This can take a bit longer if spiders don’t visit that page often.
Another option involves a 302 redirect, however, it's not an advisable practice as search engines will not pass on the rankings to the new page and, inevitably, the rankings will suffer.
Normally, 310 redirects are managed by changing
.htaccess file on your website server. The problem is that WordPress makes it quite difficult to manage without any background in web development. The easiest solution for people not involved in web development is to use a plugin that can manage redirects for them. Here at LlamasApps, we have developed a plugin that can help you with that. You can find out more about that it here. It also got a friendly assistant built-in to help you spend less time on managing redirects. Check it out :)
If you are a web developer, you may also want your clients/content editors to be able to manage redirects themselves as it can become quite difficult to deal with large volume of basic changes from their side. This makes a case for integrating a plugin into your project to save time on web development.