Kentico Xperience 13 documentation and ASP.NET Core

Most documentation about running Xperience applications under ASP.NET Core can be found in a dedicated section: Developing Xperience applications using ASP.NET Core. The rest of the documentation still applies, but some code samples and scenarios might need slight modifications for Core projects.

All major differences between the MVC 5 and Core platforms are summarized in Migrating to ASP.NET Core.

×

Settings - URLs and SEO

You can access these settings in the Settings application under the URLs and SEO category.

Routing
Routing mode

Sets the routing mode for the application.

  • Custom – the website responds to incoming requests using standard ASP.NET routing. This means that page URLs are determined by the routes that you register into your MVC application's routing table. See Custom routing using URL patterns.
  • Based on content tree – routing is based on the content tree structure of your website and dynamically adjusts to it. The feature also needs to be enabled on the side of the MVC application that presents the website. See Content tree-based routing.

Either routing mode also requires the URL page type feature enabled for the respective page type.

Content tree-based routing
Home page

Page displayed when the domain URL is requested, usually home page.

When not set, requests to the domain URL will result in a "404 Not Found" error. If you want to handle domain URLs on your own, you need to manually register a route for the domain URL in your MVC application while leaving this field empty.

The page is used as a home page for all domain aliases.

Home page URL behavior

Allows you to redirect (permanent 301) all possible URLs that access the home page of your website to one single URL. Using a unified home page URL is highly recommended because it prevents duplicate content on your website's main URL. The options are:

  • Don't use any redirection – Supports all possible home page URLs and does not perform any redirection.
  • Redirect to domain root – Always redirects to the website's base URL.
  • Redirect to home page – Always redirects to the URL of the page specified in the Home page setting.
URL format for multilingual sites

Determines the format in which page URLs are generated on multilingual sites. The options are:

  • Language prefix – If selected, the system generates page URLs with language prefixes. A language prefix is a subdirectory inserted into the URL. The name of the prefix matches the culture code of the content culture selected on the website. For example: '<domain>/en-US/Home'.
  • Domain – If selected, the system generates page URLs based on specified domain aliases. On the live site, the site domain matches the currently selected content culture and its domain alias. Whenever a user switches to a different language on the website, the URL is redirected to the corresponding domain name. For example: 'domain.com/Home' -> 'domain.es/Home'.

For more information, see Configuring URLs for multilingual websites.

Hide language prefix in default culture URLs

Ensures that the language prefix is not present in URL paths for the default content culture. For example, 'www.mysite.com/en/home' becomes 'www.mysite.com/home' when English is set as the default content culture.


This setting is applicable only on multilingual sites that use the 'Language prefix' URL format.

Enforce lowercase URLs

This setting ensures all URLs are generated in a lowercase format. The system ensures the lowercase format only for the virtual (relative) parts of the URLs.

If you wish to enforce lowercasing of the other URL parts, you need to handle it separately. For example, you can set up lower case handling of the domain name in IIS.

Use URLs with trailing slash

Specifies how the trailing slash is handled in URLs. The options are:

  • Leave URLs as they are – URLs are not modified by the system. Users can access URLs with or without a trailing slash and are not redirected.
  • Always use URLs with trailing slash – A slash is always added to the end of URLs. When requesting a URL without a trailing slash, user is always redirected to a URL with a trailing slash.
  • Never use URLs with trailing slash – A slash is never added to the end of URLs. When requesting a URL with a trailing slash, user is always redirected to a URL without a trailing slash.
Store former URLs

Enables automatic tracking of URL changes by storing old URLs and handling redirects to the current URLs.

Whenever a page's URL changes (by editing the URL slug for the given page or one of its ancestors in the content tree, by moving the page in the content tree, etc.), the system stores the former URL. Every time the former URL is requested, the system returns a "301 Moved Permanently" response and redirects the request to the new URL of the page.

You can manage these redirects in the Former URLs application.

Alternative URLs
Enable editing interface

Enables the editing interface for alternative URLs in the Pages application (after selecting a page in Edit mode, on the Properties -> URLs tab).

For the interface to be visible, the corresponding page type also needs to have the URL feature enabled. Moreover, the Alternative URLs feature needs to be enabled in the MVC application that presents the website. See Enabling alternative URLs for pages for more information.

The setting only controls the visibility of the editing interface. Any existing alternative URLs remain functional even if you disable the setting.

Alternative URLs mode

Sets the action that occurs when a visitor accesses a page through an alternative URL.

  • Redirect – the system performs a redirect (with the 301 HTTP status code) to the main URL of the given page. The main URL is determined by according to the site's routing mode:
    • In the content tree-based routing mode, the main URL of the page is determined by its position in the content tree and the configuration of the page types of its ancestors. 
    • In the custom routing mode, the main URL is determined by the URL pattern of the page type (any macros in the pattern are resolved for the specific page).
  • Rewrite – the alternative URL remains presented in the visitor's browser. The system rewrites the URL internally to the page's main URL, so that it can be served by the MVC application.

When using the Rewrite option, we strongly recommend that you render pages with canonical link elements (see Providing canonical URLs for pages). Otherwise rewritten alternative URLs lead to duplicate content issues, which can have a negative impact on the site's search engine optimization (SEO).

Excluded alternative URLs

A list of text values specifying restricted alternative URL paths (without the prefix of the site's Presentation URL). If a user attempts to add an alternative URL matching one of the specified values, the system prevents the creation and displays the error message specified in the Alternative URLs error message setting.

Every path value must be entered on a new line. The comparison is case-insensitive.

If you need to exclude a large number of URL paths, you can add the asterisk ('*') character as a wildcard to the start or end of values. The wildcard represents any number of characters.

Examples:

  • articles – the articles URL path
  • articles* – all URL paths that start with articles
  • articles/* – all URL paths whose first segment is articles
  • *articles – all URL paths that end with articles
  • *articles* – all URL paths that contain the word articles

Note:

  • The system automatically excludes certain URLs paths, for example paths starting with cms, getmedia or getfile. Such URLs are reserved for page preview links, file requests, internal on-line marketing logging routes, etc.
  • We recommend excluding the URLs paths of any routes in your MVC application's routing table that do not have matching URL patterns in your site's page types (i.e. routes not used for the main URLs of content tree pages). Otherwise a conflicting alternative URL may override an important route on your website.
  • If you modify the setting, any existing alternative URLs that match the excluded values remain in the system (visible in the Pages application), but are no longer handled in the routing of the MVC application.
Alternative URLs constraint

A regular expression that restricts which alternative URLs are allowed. The expression is matched against the alternative URL path value (without the prefix of the site's Presentation URL). If a user attempts to add an alternative URL that does not match, the system prevents the creation and displays the error message specified in the Alternative URLs error message setting.

Use the constraint to define which characters are allowed in alternative URLs or to enforce some type of structural pattern.

By default, the setting contains a pattern that allows upper and lower case alphanumeric characters, underscores ('_'), hyphens ('-'), and forward slashes ('/'). The default constraint is represented by the following regular expression: ^[\w\-\/]+$

If you modify the setting, any existing alternative URLs that do not match the constraint remain active and continue to be handled in the routing of the MVC application.

Warning: We do not recommend allowing characters that have specific meanings in URLs (such as '?' or '#'). This could cause users to submit values that result in invalid URLs or incorrect behavior.

Alternative URLs error message

The text displayed in the Pages application when a user attempts to add an alternative URL that either matches an excluded URL or does not fulfill the requirements of the URL constraint.

We recommend writing a user-friendly message that describes how to add suitable alternative URLs according to the restrictions configured for your website.

URL format

Forbidden URL characters

Allows you to list additional characters that the system replaces or removes from values that determine URLs:

The following characters are forbidden by default:

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

If necessary, the default set of forbidden characters can be overridden through the CMSForbiddenURLValues web.config key.

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.

Note: This setting cannot be used to allow the default forbidden URL characters.


Was this page helpful?