theodor.klostergaard@creuna.dk
Jun 9, 2008
  2182
(0 votes)

Not friendly to all urls

We recently created a site on the EPiServer CMS 5 platform. After having set up the site we started developing, but soon we realized that urls were not being treated as friendly as we might have hoped for. When a friendly url was pasted into the browser directly the appropriate page was shown. But no urls were rendered in a friendly way; they were all rendered as links to the aspx-page with a pageid as parameter.

First thing we did was to check and recheck the steps necessary to configure EPiServer to use the FriendlyUrlRewriteProvider. It was all good and proper: The urlRewrite element was there and the UrlRewriteModule as well. We tried using the NullUrlRewriteProvider (yes, it did use the rewriteprovider stated as default in the web.config) and switching back to the FriendlyUrlRewriteProvider (maybe it wasn't paying attention the first time?) but to no avail.

Reflector to the rescue. [cue Batman theme] How did FriendlyUrlRewriteProvider actually detect which urls to be friendly to?

After some scrutinizing the following lines awoke our suspicion:

if (HttpRequestSupport.IsSystemDirectory(url.Path))

{

    return flag;

}

What exactly is a SystemDirectory, you may ask? That's what we asked, anyway.

It turned out that we had misunderstood what was the true meaning behind the innocently looking uiUrl-attribute in the siteSettings element for the site. A SystemDirectory is a directory that starts with the value of either uiUrl or utilUrl. We had placed our templates under the uiUrl, so every time an url was encountered the FriendlyUrlRewriteProvider figured it was a SystemDirectory and did not bother to rewrite.

Moving the templates outside the uiUrl and updating the pagetypes appropriately solved the problem.

While at it we also solved a problem when rewriting urls that contained Danish characters among the parameters, but I'll post more about that some other time.

Jun 09, 2008

Comments

Please login to comment.
Latest blogs
Plug-in manager is back in CMS 12

Plug-in manager is back in the UI, what is it and how can i use it?

Luc Gosso (MVP) | Oct 6, 2022 | Syndicated blog

Display Child Pages in Content Delivery API Response

The below example will implement an instance of IContentConverterProvider to customise the serialisation of PageData and output child pages in the...

Minesh Shah (Netcel) | Oct 4, 2022

Bring the Report Center back in Optimizely CMS 12

The Report Center has been a part of Optimizely CMS since its first debut in version 5R2 in 2008, but in CMS 12, it's removed! Don't despair! Make...

Tomas Hensrud Gulla | Oct 4, 2022 | Syndicated blog

Customizing Property Lists in Optimizely CMS

Generic property lists is a cool editorial feature that has gained a lot of popularity - in spite of still being unsupported (officially). But if y...

Allan Thraen | Oct 2, 2022 | Syndicated blog

Optimizely names Luminary Senior Developer, Ynze Nunnink, OMVP

Luminary Senior Developer and Optimizely Lead, Ynze Nunnink has secured the coveted position of Optimizely MVP. Earning a Platinum badge for his...

Ynze | Oct 2, 2022 | Syndicated blog

Content Delivery API – The Case of the Duplicate API Refresh Token

Creating a custom refresh provider to resolve the issues with duplicate tokens in the DXC The post Content Delivery API – The Case of the Duplicate...

David Lewis | Sep 29, 2022 | Syndicated blog