Canonical URLs and Ektron

  • Updated

Canonical URLs are a method for improving the SEO of pages that contain multiple URLs pointing to the same pice of content.

The Ektron product line does not currently have an out of the box method for setting Canonical URLs for content items with multiple URLS pointing to the same destination. 

There are options to configure rewrite rules for 301 redirects, but if canonical URLs would be needed they would need to be done via IIS or within a web.config module. The following two blog post have been helpful to some customers that have been looking to configure canonical URLs in past support tickets. The development of this functionliaty would fall outside of the scope of our support team, and the below samples have neither been tested by our support or engineering teams.

Source: https://www.kalyani.com/blog/2010/01/14/redirecting-to-canonical-url-in-iis7/
Step 1: Install the UrlRewrite module for IIS: http://www.iis.net/expand/URLRewrite
Step 2: Add the following rule to your applications web.config file:

<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Redirect from www" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.yoursite.com$" />
</conditions>
<action type="Redirect" url="http://yoursite.com/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

IMPORTANT: When using the above code, take care to merge it with your existing web.config without duplicating any existing elements.

Source: https://www.pipeten.info/web-config-useful-code/#canonical-redirect
If your website can be reached from more than one URL, for example http://yourdomain.co.uk/home or http://home.yourdomain.co.uk, for SEO (Search Engine Optimisation) purposes it is better to just pick one of these URLs as the preferred way to access your website.

1. Create your web.config file.
2. Enter in the following code:

<configuration>
<system.webServer> 
<rewrite> 
<rules>
<rule name="Redirect to WWW" stopProcessing="true"> 
<match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^domain.com$" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

3. Replace domain.com in the above code with your domain name and save within the configuration section of your web.config file.