Send mail to the author(s) E-mail

View Richard Soeteman's profile on LinkedIn

RSS 2.0 | Atom 1.0 | CDF




The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Sign In


# Friday, October 3, 2014
Friday, October 3, 2014 12:14:22 PM (GMT Daylight Time, UTC+01:00) ( SEO Checker | Umbraco )

This Blog is not active anymore, further posts will be available on my company website. Read new posts here

Recently Google announced that it will use HTTPS as a ranking signal in the future. With SEO Checker I don’t follow trends but this one will be in a future release since it’s coming from Google itself. But this will be a change in the configuration screen since it’s too bloated already, and that is not something for a small bug fix release. Anyway a customer already asked if there was an easy way to do this in SEO Checker. The answer is yes. Until today this wasn’t documented but if you reference the SEOChecker.Extensions project you can use the UrlRewriterProviderBase class.

When you see  the snippet below you’ll see that it’s really easy. Just modify the UrlBuilder object that is coming in. In the case of always https we set the scheme to HTTPS when the incoming request comes from http. Compile this class add it to the bin folder and it will be picked up automatically by SEO Checker and redirects to Https for all website requests (umbraco requests are not redirected automatically).

   1: /// <summary>
   2:  /// Forces Redirect to HTTPS
   3:  /// </summary>
   4:  public class HTTPSRedirect : UrlRewriteProviderBase
   5:  {
   6:      public override void RewriteUrl(UrlBuilder builder, UrlRewriteConfiguration config)
   7:      {
   8:          if (builder.Scheme.Equals("http", StringComparison.InvariantCultureIgnoreCase))
   9:          {
  10:              builder.Scheme = "https";
  11:          }
  12:      }
  13:  }

Canonical URL

If you are familiar with SEO Checker already you have probably used the Library methods  to generated all meta data. This library generates the canonical link tag also. When you rewrite your url’s using the SEOChecker UrlRewriter it will use your class also to determine the canonical url (’'). This is a benefit you don’t get when you apply your own rewrite rules in web.config.

   1: <title>Getting Started | SEO Checker</title>
   2: <meta name="description" content="You&#39;ve installed Umbraco and the &quot;Txt&quot; Starter Kit." />
   3: <meta name="robots" content="index, follow" />
   4: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   5: <link rel="canonical" href=""/>

Download the source for this project. Drop the SEOChecker.HTTPSRedirect.dll in the bin folder and it will start redirecting to HTTPS immediately.

Happy rewriting!