Try our conversational search powered by Generative AI!

theodor.klostergaard@creuna.dk
Jun 9, 2008
  2731
(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
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog