HTTP to HTTPS and WWW to Root: A Practical Guide to Monitoring Website Redirects

Ensure your website's redirects are working as expected by learning how to effectively monitor HTTP to HTTPS and WWW to root domain transitions.

Author
Mike Robbins

Monitoring HTTP redirects is crucial to maintain the accessibility and user experience of your website or web application. Misconfigured redirects can lead to broken links, negatively impacting your site's SEO and user experience. Heii On-Call's outbound probes are an excellent tool to continuously monitor the availability and correct configuration of these redirects.

Any website, for example example.com, typically has four common URLs that users or search engines might expect the site to be available at:

http://example.com/ # should redirect
https://example.com/ # desired!
http://www.example.com/ # should redirect
https://www.example.com/ # should redirect

In order to make sure your site appears when someone types it into their browser, webmasters should make sure that all four of these lead to the same page. This is accomplished by configuring redirects, such as HTTP 301 Moved Permanently or HTTP 308 Permanent Redirect, on the other three.

Monitoring www to non-www Redirects

Many websites redirect www subdomains to the root domain (or vice versa – just be consistent!) for SEO and usability reasons. To ensure this redirect is functioning correctly, you can configure an outbound probe in Heii On-Call:

Name: www to root domain redirect
URL: https://www.example.com/
Expected Status Code: 301 https://example.com/

The probe will pass if a 301 status code is returned, and the location header exactly matches https://example.com/.

Monitoring HTTP to HTTPS Redirects

HTTPS, the secure version of HTTP, is a must-have for modern websites. Not only does it secure your user's information, but it's also a ranking signal for search engines like Google. Configure an outbound probe as follows:

Name: HTTP to HTTPS redirect
URL: http://example.com/
Expected Status Code: 301 https://example.com/

In the example above, the probe will consider the test successful if the server responds with a 301 Moved Permanently status code and a location header pointing to your HTTPS domain.

Tech Details on HTTP to HTTPS redirects

There are two recent changes affecting HTTP to HTTPS redirects:

First, the Chrome browser now requests HTTPS pages by default when a bare domain is typed. However, other browsers may behave differently, and automated tools such as search engine crawlers may still attempt to crawl your unencrypted URL.

Second, the HTTP Strict-Transport-Security (also known as HSTS) header is growing in popularity. However, the first visit to a new site (such as when someone first types in your domain name) is not covered, unless you’re part of a browser-integrated HSTS preload list.

Having HTTP to HTTPS redirects configured properly means your site will always be found at the desired location, and that search engines will send people directly to your HTTPS site.

Monitoring the Fourth Quadrant

It’s possible for the user to both use unencrypted HTTP protocol and specify the undesired www subdomain, so we add one more probe to cover this case:

Name: www subdomain and HTTP to HTTPS redirect
URL: http://www.example.com/
Expected Status Code: 301 https://example.com/

In the example, we’re assuming you are redirecting directly to the correct URL. However, depending on the precise configuration of your web server or load balancer, you may find it actually performs a sequence of two redirects: first from HTTP to HTTPS and second from www to root domain, or vice versa. If this is the case, you’ll need to tweak the Expected Status Code setting to cover only the first redirect.

Monitoring Other Redirects

You may also have other redirects in place, such as old URLs redirected to new ones. For any of these cases, you can specify the expected status code and location.

Name: Old blog subdomain
URL: https://blog.example.com/
Expected Status Code: 301 https://yourdomain.com/blog

Again, the probe will pass only if the server responds with a 301 status code, and the Location header exactly matches the new URL.

Monitoring the Main Page

Lastly, it's a good practice to monitor the status of your main page. A probe can be configured to check for a successful HTTP response.

Name: Homepage
URL: https://example.com/
Expected Status Code: 200

In this example, the probe will pass if the server responds with a 200 status code, indicating the page is functioning as expected.

With Heii On-Call's outbound probes you can continuously monitor the uptime and correct configuration of your website and your most important HTTP redirects, ensuring your website or web application is always accessible and providing a seamless user experience, and alerting your team when there’s any issue.

Outbound Probes are easy to set up and keep monitoring continuously. Try our free website monitoring today!