Fixing THE Umbraco quirk

Admit that you've forgotten the trailing slash after umbraco a hundred times.

Admit that it has made you use a thousand words your mother never taught you.

Admit that you've had hundreds of calls from customers in the same predicament.

Well... I have.

And all this time I've been convinced that there was no easy fix - if there was, someone would have implemented it.

Today, I got fed up and just tried the simplest fix I could think of - just for the heck of it.

Guess what? It worked! One XML tag with some attributes in the rewrites section of /config/UrlRewriting.config and hey, presto, the umbraco backend now follows the HTTP specification on how trailing slashes should be handled - transparently.

Here it is:

urlrewrite-umbraco-slash.PNG

EDIT: I'm very sorry that I have to give you the XML as an image instead of using our newly installed syntax highlighter, but ASP.NET barfs when trying to display the app-relative path (with ~)  in the destinationUrl when I try to do that, so I have no other option (there is probably a fix... maybe I'll try to find it some day)... :(

EDIT: Actually, what a HTTP-compliant web server does when it encounters a "directory URL" that doesn't end with / is a redirect to the same URL with the / appended. This causes an extra round-trip but is by design. So, what my fix does is exactly what the standard stipulates.

Posted by Peter Josefson at 11:22

3 Comments:

Kalle Ekstrand said...
Nice! So simple...
September 27, 2011 22:09
Max Öhman said...
Yay!
September 28, 2011 09:09
Amazing! Why havent anyone done this before?
October 4, 2011 22:10

Post a comment