Some SEO rules regarding Sitefinity

Some SEO rules regarding Sitefinity

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 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 host names 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 request that are beginning without www:

<rule name="Canonical Hostnames">
   <match url="(.*)" />
      <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
         <add input="{HTTP_HOST}" pattern="^www\.konstrui\.nl$" negate="true" />
      </conditions>
      <action type="Redirect" url="http://www.konstrui.nl/{R:1}" />
</rule>

Trailing slashes

Same story we have with adding or removing trailing slashes. A URL could have lot's 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:

<rule name="Remove trailing slashes" stopProcessing="true">
   <match url="(.*)/$" />
   <conditions>
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
   </conditions>
   <action type="Redirect" url="{R:1}" />
</rule>

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:

<rule name="Remove default documents" stopProcessing="true">
   <match url="(.*)" ignoreCase="true" />
   <conditions logicalGrouping="MatchAny" trackAllCaptures="false">
      <add input="{REQUEST_URI}" pattern="^\/home$" />
      <add input="{REQUEST_URI}" pattern="^\/default.aspx$" />
   </conditions>
   <action type="Redirect" url="http://www.konstrui.nl" appendQueryString="false" redirectType="Permanent" />
</rule>

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

door Daniel Plomp

Reactie

RadEditor - HTML WYSIWYG Editor. MS Word-like content editing experience thanks to a rich set of formatting tools, dropdowns, dialogs, system modules and built-in spell-check.
RadEditor's components - toolbar, content area, modes and modules
   
Toolbar's wrapper 
 
Content area wrapper
RadEditor's bottom area: Design, Html and Preview modes, Statistics module and resize handle.
It contains RadEditor's Modes/views (HTML, Design and Preview), Statistics and Resizer
Editor Mode buttonsStatistics moduleEditor resizer
  
RadEditor's Modules - special tools used to provide extra information such as Tag Inspector, Real Time HTML Viewer, Tag Properties and other.