LinkManager – Working with URL’s in Sitecore 6

Have you noticed that a page in Sitecore 6 can be accessed through several URL’s? This is an example of the products page on the Sitecore website. The following URL’s are all valid and points to the same page and the same language:{5D8489BF-419B-4336-B9DA-CA704C682B51}

This can confuse statistical tools like Google Analytics, as the statistical data is collected per URL basis. Sitecore’s own Online Marketing Suite does not have this problem, but all tools that collects data from Javascripts inserted on the page will get confused. It is hard to get a total number of hits for one page, as you have to collect the statistics scattered over many URL’s.

So how can you limit the number of URL’s to one page? The solution lies within the linkManager setting in web.config:

<linkManager defaultProvider="sitecore">
    <clear />
    <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel"
         useDisplayName="false" />

These are the default settings in the web.config, which allows the widest range of available URL’s per page. But this is not always a good thing. The following settings caught my eye:


This setting allows Sitecore to add the language as a part of the URL “as needed”. In practice this means “as the wind blows” because it is very hard to find a pattern for when the language is added and not. My recommentation is to use “always” for multiple language sites, and “never” for single language sites.

Another cool setting is this:


Setting this to “false” removes the .aspx extension for all URL’s. In order for this to work you will need to use IIS7 and map all incomming requests to ASP.NET, or write your own 404 error handler that redirects any incomming request to the correct .aspx page.

About briancaos

Developer at Pentia A/S since 2003. Have developed Web Applications using Sitecore Since Sitecore 4.1.
This entry was posted in Sitecore 6 and tagged , , , . Bookmark the permalink.

6 Responses to LinkManager – Working with URL’s in Sitecore 6

  1. Nariman says:

    Thanks for the article. I don’t think you need II7 to use addAspxExtensino=false though; in IIS6, associating wildcard mappings with ASP.NET ISAPI should do.

  2. Bo Breiting says:

    Excellent article. Also another thing to point out is that one should always use the built in methods and controls in the Sitecore API when dealing with links to assure that they are handled by the linkmanager instead of simply accessing link fields as raw text and programmatically constructing links. This will insure that the links always comply with the rules specified in the web.config.

  3. Pingback: Sitecore 6 addAspxExtension=”false” issue « Brian Pedersen’s Sitecore and .NET Blog

  4. Pingback: Multiple languages in Sitecore « Brian Pedersen’s Sitecore and .NET Blog

  5. John West says:

    If you use aliases, you might want to use them consistently, so that search engines don’t index the same content twice. I wrote a blog post about this, but I can’t vouch for the code.!960125F1D4A59952!167.entry

  6. Pingback: Which of my old Sitecore posts are still valid in Sitecore 9? | Brian Pedersen's Sitecore and .NET Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.