URL format and configuration

Defining URL extensions

Page URLs can use various types of extensions. By default, all URLs end with .aspx, for example: http://www.example.com/products/kentico-cms.aspx

You can also use custom extensions, such as .htm, .html or any other sequence of characters, or URLs without extensions, such as http://www.example.com/products/kentico-cms. In this case, you need to configure the system as described in Extensionless and custom URLs.

Forbidden URL characters

Certain characters have special meanings in URLs, so they cannot be used in values that determine the path to pages (i.e. page aliases and URL paths). By default, the following characters are forbidden:




\/:*?"<>|&%.'#[]+=„" and the space character

To specify additional forbidden characters:

  1. Open the Settings application.
  2. Select the URLs and SEO category.
  3. Type the characters into the Forbidden URL characters setting (without any separator).
  4. Click Save.

Alternatively, you can enter a regular expression into the Allowed URL characters setting to precisely specify which characters are allowed in URLs.

Note

The default characters listed above are always forbidden unless you override the CMSForbiddenURLValues key in the /configuration/appSettings section of your application’s web.config file. For example:




<add key="CMSForbiddenURLValues" value="$\/:?&quot;&lt;&gt;|&amp;%.&apos;#[] =" />


You can either use the key to allow some of the default forbidden characters, or add new ones. It is strongly recommended to keep the default characters forbidden — entering the characters into URL paths may prevent certain types of URLs from working correctly.

The system automatically replaces or removes forbidden characters. You can specify the character that is used to replace forbidden characters through the Forbidden characters replacement setting in Settings -> URLs and SEO. By default, forbidden characters located at the beginning or end of the path are removed completely and consecutive forbidden characters are only replaced by a single character. If you wish to have each forbidden character replaced individually, add the following key to your web.config:




<add key="CMSLimitUrlReplacements" value="false" />


This preference may also be set specifically for the Page URL Path property of pages (and no other URLs) via the key below:




<add key="CMSUseLimitReplacementsForUrlPath" value="false" />


Advanced character replacement customization

You can change the character replacement behavior to deal with specific scenarios, such as handling non-ASCII character sets or assigning unique replacement strings for specific characters.

This can be achieved by customizing how the system converts URLs into a safe format. See Custom handling of URL path values for more information.

Using URL Prefixes

If you need to add a prefix to all URLs on a specific site (e.g. for search engine optimization), you can specify it in Settings -> URLs and SEO -> Default Url path prefix. The URLs use the following format: <domain>/<path prefix>/<page URL path>

For example: http://www.example.com/myprefix/products/kentico-cms.aspx

Using language prefixes for URLs

To add a different URL prefix for every page culture version, type the prefix into the Settings -> URLs and SEO -> Use language prefix for URLs setting. If you have both language prefixes and standard URL path prefixes enabled, the standard URL prefix always precedes the language prefix in the URL. Refer to Configuring URLs for multilingual websites for more details.

Reference - URL settings

The above configuration tasks can be performed via the Settings application in the URLs and SEO category. The following table shows an overview of the available settings:

URL format

Forbidden URL characters

List of additional characters that cannot be used in URLs (page aliases and URL paths).

The following characters are forbidden by default: \/:*?“<>|&%.’#[]+=„“ and the space character.

Forbidden characters replacement

Specifies the character that the system uses as a replacement for forbidden characters in URLs.

Allowed URL characters

Determines which characters are usable in URLs by means of a regular expression. Any characters not specified are forbidden. If empty, only the characters specified by the Forbidden URL characters setting are prohibited.

When allowing special characters in the regular expression, they must be preceded by a backslash (\) as an escape character.

Example: Entering a-zA-Z0-9\^ as the value only allows alphanumeric characters and the caret symbol (^) to be used in URLs.

Friendly URL extension

Specifies the extensions that the system adds to page URLs.

  • Extensions must be preceded by the period character.
  • You can add multiple extensions separated by semicolons (;).
  • The first extension is used as the default option when generating links and page URLs. Additional extensions are supported in URLs when accessing pages.
  • To allow extensionless URLs, enter a semicolon without any extension.

Sample value: .aspx;.html;.htm;;

Files friendly URL extension

Specifies the extension that the system adds to file URLs.

Example: getfile/<node alias>/myimage.aspx

If empty, file URLs either have no extension or use the given file’s default extension.

If you set this setting to an empty or custom value, you need to allow custom URL extensions by adding the runAllManagedModulesForAllRequests attribute to the <modules> element in the <system.webServer> section of your project’s main web.config file.

Excluded URLs

Specifies a list of URLs that are excluded from the URL rewriting engine. See Excluding URLs from the rewriting engine for more information.

Page URLs

Default URL path prefix

Defines a default URL path prefix used for all URLs of content pages. Internally, this prefix is rewritten to the urlpathprefix query string parameter.

Use name path for URL path

If checked, the system automatically copies page name paths to the URL path.

Use permanent URLs

If enabled, URLs of pages and page attachments are generated in permanent format. If disabled, friendly URLs are used. Learn more in Linking pages and files.

Remember original URLs when moving pages

Indicates if the system creates new page aliases when a user sets a new page URL path or extension for a page.

Automatically update page alias

If enabled, the alias of pages is automatically updated to match any changes in the name of the given page in the default culture. When enabled, the page alias property cannot be edited manually.

Other settings (related to SEO) may also affect the format of URLs. To learn about these, refer to the Search engine optimization chapter.