November Happy Hour will be moved to Thursday December 5th.

theodor.klostergaard@creuna.dk
Jun 9, 2008
  2834
(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
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog