SEO Friendly Urls in Sitecore -Remove spaces in Url

by aboo bolaky 29. November 2008 09:50

Aliases in Sitecore

Sitecore has the concept of "Aliases", whereby each item can accessed using a specific name (rather than the default path). Aliases are turned on by default. To turn them off, you can flip the web.config settings name AliasesActive to false (But who would want to do that???? Sealed)

Space Characters in Sitecore

When you create an item in Sitecore, you free to choose the naming of your item (provided it succesfully validates against some key rules .e.g Item name cannot contain :,?.. otherwise, you will end up with a "Item xxx is not a valid name"). Most of the time, you will want to put spaces in the item name. Let's take an example:

If an item (at the root level) has an item name of "John Doe", the url of the actual page should theoretically be http://hostname/John%20Doe .

Of course, you can get rid of this spacing issue by specifying an Alias of John-Doe on the item itself. But imaging you having hundreds of items with spaces !!!..

The encodeNameReplacements element in the Web.config

This encodeNameReplacements settings allow you to globally replace any unwanted character in your url to a character of your choice. So, rather than creating an alias for each item (without spaces), we can add the following new setting.

<encodeNameReplacements>
	<replace mode="on" find="&" replaceWith=",-a-,"/> 
	<replace mode="on" find="?" replaceWith=",-q-,"/>
	.....
	<replace mode="on" find=" " replaceWith="-" />
</encodeNameReplacements> 

Job Done ! Cool

 

Tags:

.Net | Applications | Sitecore | Tips & Tricks

Comments

5/20/2010 7:11:44 PM #

Cheap Nike Shoes

Thank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information

Cheap Nike Shoes United States |

11/5/2011 6:39:05 AM #

Marrakech riad

As I website proprietor I create the meaning here is actual brilliant , remarks for your labors.

Marrakech riad France |

11/5/2011 7:32:46 AM #

louer riad marrakech

Thanks for all your struggles that you get put in this. exceedingly interesting info . “Either you scurry the date or the date scurrys you.” by Jim Rohn.

louer riad marrakech France |

11/7/2011 6:21:42 AM #

sejour Marrakech

Only wanna pronounce that this is very cooperative, Acknowledges for taking your rhythm to communicate this. “We can’t many be heroes so celebrity has to perch on the hinder further applaud as they go by.” by Volition Rogers.

sejour Marrakech France |

11/7/2011 7:19:23 AM #

Guide Marrakech

I dugg any of you inform as I notion they were too cooperative adroit

Guide Marrakech France |

11/13/2011 5:06:10 AM #

Marrakech guide

Deference to condition founder , several grand choosy material . “When you desist to ideal you desist to reside.” by Malcolm Stevenson Forbes.

Marrakech guide France |

11/13/2011 6:05:47 AM #

voir Marrakech

Wohh precisely what I was looking for, estimations for putting up. “The barely manner of sensible a creature is to tenderness them minus anticipation.” by Walter Benjamin.

voir Marrakech France |

11/15/2011 1:53:07 PM #

vente immobilier maroc

Good blog! I indeed tenderness how it is compliant on my orbs besides the information are well written. I’m wondering how I power be notified whenever a pristine dispatch has been made. I possess subscribed to your RSS which essential do the dupe! Possess a huge age! “Reputation is what further folk understand about you. Hail is what you understand about yourself.” by Lois McMaster Bujold.

vente immobilier maroc France |

11/15/2011 3:44:45 PM #

vente immobilier maroc

Exactly what I was searching for, cherish it for posting . “There are multitudinous victories worse than a subdue.” by George Eliot.

vente immobilier maroc France |

Tag cloud

Flash Player 9 required.

About Me

I wish I could write something here..
//TODO: ElaborateMe