Extension-less URL’s in Umbraco

Umbraco has built-in support for human-readable, SEO-friendly URL’s and in addition supports the omission of the .aspx extension, so that for example instead of http://www.mysite.com/news.aspx you could have the URL http://www.mysite.com/news/

In order for the CMS to generate links in the navigation which don’t have the .aspx extension, you need to find the following key in the appSettings element of the web.config and set the value to true:

<add key="umbracoUseDirectoryUrls" value="true" />

Once you set this key, the CMS generates aspx-free URL’s within all navigation templates. However depending on the version of IIS you’re running on, these extension-less requests won’t necessarily be processed by ASP.NET correctly without a little further work. If you’re running IIS7 in integrated mode, it should work automatically. However, IIS 6 will think you’re just requesting a folder or file, and won’t invoke ASP.NET to process the request.

A more detailed article on this can be found here: Setting up Umbraco for friendly URLs

Wildcard mapping in IIS6 works, but is a sledgehammer approach. It means that ALL requests get sent from IIS to ASP.NET. ASP.NET will be slower to process requests for things like images and files, and therefore it’s generally better to let IIS deal with these where possible.

A better approach is to use an ISAPI extension such as Helicon’s “ISAPI_Rewrite”, and to add a URL rewrite rule that follows the logic “if this request has no file extension, then add .aspx on to the end before IIS gets hold of it”.

Here’s an example set of rules (taken from this article about clean URL’s on the Umbraco forums):


#exclude the /umbraco folder from this filter
RewriteRule ^/(umbraco.*)$ /$1 [L]
#include everything else from the website
#everything without extension will have .aspx
RewriteRule ^/([^.?]+)/?(?.*)?$ /$1.aspx$2 [L]


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

%d bloggers like this: