July 2010 » URL Rewriting & Aliasing in Kentico CMS
Jul 01

URL Rewriting & Aliasing in Kentico CMS

Kentico CMS is extremely powerful when it comes to controlling the URL of a website. Right out of the box, you get the power of aliasing whatever URL you want to whatever document or resource you have in the content tree.

Heck since Kentico 4.x you can even mask/change the extension or just get rid of it all together, to get more control of your site’s URLs.

I can’t stress enough how beneficial this feature is when it comes to creating SEO friendly links, maintaining out of date website paths/structure, or just making it easier on your visitors to reach the pages that they need to get to.

Let’s get started with an example. For instance let’s say your website had a products section that sold different types of potato chips. My favorite potato chips are Baked Lays. So we will go with that for the example.

Way back when developers didn’t do much to make the URL SEO or user friendly, you would have a typical URL like these:


http://mcbeev.com/products/chips.aspx?name=Baked Lays

Google and other search engines see this only as one URL, …/chips.aspx, which doesn’t do us very good.

Now let’s say you had this same website in Kentico. It might look something like this:

 

Kentico CMS Content Tree

 

There a few things to notice, first if you navigate to the Baked Lays page your URL would be:


http://mcbeev.com/Products/Baked-Lays.aspx

This is nice right? No crazy question mark in the QueryString or namevalue pairs. This is one example of URL Rewriting. Behind the scenes there is no physical file on the file system that IIS is serving out. The Kentico 404 HTTPHandler is intercepting the request and and feeding it through the content in the database of the site you have, and serving out the correct page based on that.

The second thing to notice is the .aspx extension. I mentioned above that you can mask that extension or even get rid of it. We see it here because by default in Kentico Extensionless URLs are turned off. If you check the Friendly URL extension field in the CMSSiteManager –> Settings –> URLs and SEO section, you will see .aspx value. Just clear this field out and click save and now URLs will work as:


http://mcbeev.com/Products/Baked-Lays

As you can see your end result is even nicer now.

(Note: You may need to configure II6 or II7 to handle Extensionless URLs as well, please check out the Kentico Documentation for further info on that)

So for instance, if you also sold Doritos, your more savvy users might be able to just look at the URL in the address bar and guess what they should type in to get to a different product page. Maybe:


http://mcbeev.com/Products/Doritos

And it would just work. This really just brings a nice and logical experience to your users, and Kentico does a great job of it.

One more point on Document Aliasing. An alias allows you to make up a URL that can be completely different than what the name of the document is in the Tree. To add an Alias go to the CMSDesk –> Select your Page –> Properties –> URLs subtab:

 

Kentico CMS Document URLs tab

 

You can see that I added a Document Alias with a URL Path of /Products/Best-Chips-in-the-World. If you copy that into your browser that will lead you to the exact same page as /Products/Baked-Lays. You can have as many of these Document Aliases as you want on each document.

Now I know what you are thinking if you are a long time user of Kentico, and that probably is: Brian why are you writing a blog post on such old features like this ?

And the sixty four thousand dollar answer is… I want to make sure that you have a good understanding of URL Rewriting and Document Aliasing, because in my next post I am going to throw a twist into the the whole situation and solve one shortcoming that Kentico has on this very topic.

Check back next time!

Update: See the next post in the series here.

You might also be interested in

[X]

Be the first to know about my latest Kentico Tips & Tricks!

Do not show again