"&" (ampersand sign) in the Kentico page names to convert them to "and" in the URLs.

innovix solutions asked on July 3, 2019 05:52

Hi all,

we want to convert "&" (ampersand sign) in the Kentico page names, convert them to "and" in the URLs. Please suggest on this. We are using K12 MVC approach.

Recent Answers


Brenden Kehren answered on July 3, 2019 15:38

By default, you can set some of these properties in the Settings > URLs and SEO > URL Format. In here you can see there is a forbidden URL character setup. By default "&" is included. It will automatically replace it with a "-" (dash). Since this is NOT what you want, you have a few options (listed simplest to hardest):

  • Educate your content entry people to enter "and" vs. "&" when adding content to the field which generates the URL.
  • Create a global event handler on insert and update of pages to do a string.Replace() of the path.
  • Use a URL Rewrite rule to change "&" to "and". Problem with this is it may mess up anything you might have querysting parameters for.

There are probably other ways, but those are the ones I've initially thought of.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.