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:
- Open the Settings application.
- Select the URLs and SEO category.
- Type the characters into the Forbidden URL characters setting (without any separator).
- 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="$\/:?"<>|&%.'#[] =" />
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 |
Friendly URL extension |
Specifies the extensions that the system adds to page URLs.
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, the file URLs end with no extension: getfile/<node alias>/myimage |
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.