SiteCozy

  • My account

How does a 301 redirect work?

2019-02-21

A “301 Moved permanently” redirect isn’t an error, but we want to give details about it. The goal of a 301
redirect is to redirect the client to the right URL. The target location may be a different file, a different folder, a
different domain, a different protocol (for example: http=>https) than the original URL requested by the client.
Consequently, the first response of a server is 301. Nevertheless, 301 redirects can be an issue under some
circumstances. If there are too many 301 redirects, Googlebot will give up following the redirects. According to
the Google employee Matt Cutts, Googlebot follows up to 6 redirects before giving up. This means that at the
end, if there are too many redirects for a page, the said page is not going to get crawled by Googlebot. For your
information, the sitecozy broken link checker is tuned to return an error after 15 redirects.

EXAMPLE OF A 301 REDIRECT WITH CURL


In the following example, you can see the communication between the client and the server. The client sent a
first request to get http://tomydna.com , then, the server first responded with a 301 redirect to the client
mentioning that the ultimate location of the page was https://tomydna.com , the client made a new request to
get https://tomydna.com, and the server provided the headers for https://tomydna.com and a successful delivery status 200 OK.

$ curl -v http://tomydna.com -I -L
* Rebuilt URL to: http://tomydna.com/
* Trying 85.17.26.201...
* TCP_NODELAY set
* Connected to tomydna.com (85.17.26.201) port 80 (#0)
> HEAD / HTTP/1.1
> Host: tomydna.com
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
HTTP/1.1 301 Moved Permanently
< Date: Thu, 21 Feb 2019 13:27:52 GMT
Date: Thu, 21 Feb 2019 13:27:52 GMT
< Server: Apache
Server: Apache
< Location: https://tomydna.com/
Location: https://tomydna.com/
< Cache-Control: max-age=0
Cache-Control: max-age=0
< Expires: Thu, 21 Feb 2019 13:27:52 GMT
Expires: Thu, 21 Feb 2019 13:27:52 GMT
< Content-Type: text/html; charset=iso-8859-1
Content-Type: text/html; charset=iso-8859-1
<
* Connection #0 to host tomydna.com left intact
* Issue another request to this URL: 'https://tomydna.com/'
* Trying 85.17.26.201...
* TCP_NODELAY set
* Connected to tomydna.com (85.17.26.201) port 443 (#1)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
 CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: CN=tomydna.com
* start date: Jan 30 00:00:00 2019 GMT
* expire date: Apr 30 23:59:59 2019 GMT
* subjectAltName: host "tomydna.com" matched cert's "tomydna.com"
* issuer: C=US; ST=TX; L=Houston; O=cPanel, Inc.; CN=cPanel, Inc. Certification Authority
* SSL certificate verify ok.
> HEAD / HTTP/1.1
> Host: tomydna.com
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Thu, 21 Feb 2019 13:27:52 GMT
Date: Thu, 21 Feb 2019 13:27:52 GMT
< Server: Apache
Server: Apache
< Link: <https://tomydna.com/wp-json/>; rel="https://api.w.org/", <https://wp.me/P9G7UU-d>; rel=shortlink
Link: <https://tomydna.com/wp-json/>; rel="https://api.w.org/", <https://wp.me/P9G7UU-d>; rel=shortlink
< Cache-Control: max-age=0
Cache-Control: max-age=0
< Expires: Thu, 21 Feb 2019 13:27:52 GMT
Expires: Thu, 21 Feb 2019 13:27:52 GMT
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
<
* Connection #1 to host tomydna.com left intact

As you can see the 301 redirects add additional data exchange between the client and the server. When you multiply the number of exchanges by the number of requests a server receives from users and bots, it ends up in a considerable number of additional interactions. Additional requests stress the web server. That’s why it is better to keep a low amount of 301 redirects.

Related Posts:

  • How to create redirects for a WordPress site without Htaccess/nginx
  • Do 302 redirects pass link juice?
  • Don't trust the domain redirections provided by your registrar
Download our Broken link checker freeware here Buy a license key for the Sitecozy broken link checker

Customer Login

Lost password?

Categories

  • Webmaster advice
  • SEO advice
  • Web hosting
  • SiteCozy link checker KB
  • WordPress theme & plugin reviews
  • All articles
Disclosure: We are a professional review site that receives compensation from the companies whose products we review. We test each product thoroughly and give high marks to only the very best. We are independently owned and the opinions expressed here are our own.

Copyright Sitecozy 2018