theodor.klostergaard@creuna.dk
Jun 9, 2008
  2765
(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
Opti ID overview

Opti ID allows you to log in once and switch between Optimizely products using Okta, Entra ID, or a local account. You can also manage all your use...

K Khan | Jul 26, 2024

Getting Started with Optimizely SaaS using Next.js Starter App - Extend a component - Part 3

This is the final part of our Optimizely SaaS CMS proof-of-concept (POC) blog series. In this post, we'll dive into extending a component within th...

Raghavendra Murthy | Jul 23, 2024 | Syndicated blog

Optimizely Graph – Faceting with Geta Categories

Overview As Optimizely Graph (and Content Cloud SaaS) makes its global debut, it is known that there are going to be some bugs and quirks. One of t...

Eric Markson | Jul 22, 2024 | Syndicated blog

Integration Bynder (DAM) with Optimizely

Bynder is a comprehensive digital asset management (DAM) platform that enables businesses to efficiently manage, store, organize, and share their...

Sanjay Kumar | Jul 22, 2024