Technical

Some SEO rules regarding Sitefinity

Recently I was trying out some IIS Rewrite Rules to optimize my Sitefinity websites. Some of these rules are very effective in making your website SEO-proof.

Daniel Plomp

December 5th, 2018

Background information

Recently I was trying out some IIS Rewrite Rules to optimize my Sitefinity websites. Some of these rules are very effective in making your website SEO-proof. 

I’ll name three of them here to get started. I’ll show you how to add these rules into your web.config. You can also use the IIS Rewrite module to let IIS add the rules to your web.config. Canonical names When setting up new websites in IIS you specify which hostnames map to your site. This is called Bindings in IIS terms. 

Usually, this is at least two: www.example.com and example.com, sometimes even more. The reason this is important for SEO purposes is that search engines treat all URLs differently, so when you have two or more URLs all pointing to the same content your search ranking will suffer. To fix this we want to have a primary hostname configured. The following rule is redirecting konstrui.nl to www.konstrui.nl and of course all requests that are beginning without www:

Trailing slashes
Same story we have with adding or removing trailing slashes. A URL could have lots of combinations:

- www.konstrui.nl
- www.konstrui.nl/
- konstrui.nl
- konstrui.nl/ 

So, it is could to pick one format and stick with it. I prefer to remove the trailing slash at the end. To remove the trailing slashes we could do something like this:

Default document and Homepage
This is a more specific rule as some CMS systems or websites handle this differently. Regarding Sitefinity, we have to deal with this issue. When you browse to www.konstrui.nl you will get the homepage served and the URL doesn’t change. When you click on the home link from the navigation menu, you see the URL changes to www.konstrui.nl/home. This is because every page inside Sitefinity needs to have an URL name. You can’t add pages through the UI without a URL name. This URL name is what makes a page unique in the Sitefinity website.

So what we want is that if visitors browse to our homepage they always and up with this URL: www.konstrui.nl To do this, we can add the following rule:

Credits to Stephen Pittman for pointing me to the last solution.

All rights reserved © ZimplerApps 2018