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):

[ISAPI_Rewrite]

#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]

 

Additional Umbraco specific appSettings

“umbracoXsltPath” – by adding this to appSettings you can specify a new/different folder for storing your xslt files and still be able to edit them within Umbraco. Default folder is ~/xslt.

“umbracoUsercontrolsPath” – by adding this to appSettings you can specify a new/different folder for storing your UserControls. Default folder is ~/usercontrols.

“umbracoMasterPagesPath” – by adding this to appSettings you can specify a new/different folder for storing your Masterpages. Default folder is ~/masterpages.

“umbracoCssDirectory” – by adding this to appSettings you can specify a new/different folder for storing your css-files and still be able to edit them within Umbraco. Default folder is ~/css.

“umbracoMediaPath” – by adding this to appSettings you can specify a new/different folder for storing your media files. Default folder is ~/media.

“umbracoScriptsPath” – by adding this to appSettings you can specify a new/different folder for storing your javascript files and still be able to edit them within Umbraco. Default folder is ~/scripts.

Customising the RTE (Rich Text Editor) in Umbraco

Umbraco uses TinyMCE for the rich text editor data type (the same JavaScript RTE as many other CMS’s including some of the Enterprise products).

In terms of customising the RTE, generally most of what’s in the TinyMCE Wiki will apply to Umbraco installations. However, there are also plenty of examples of Umbraco-specific customisation:

  • Adding custom styling options to the ‘Styles’ drop-down:

Customised TinyMCE Editor to Allow Heading Tags to be applied

  • Allowing users to insert their own micro-templated regions within the RTE:

Enabling the ‘Template’ plugin for TinyMCE