Setting domain names for sites

The Domain name is one of the basic properties that you assign when creating new sites. The system generates the URLs of the website's pages and other components using the specified domain name. Every website running in the system must have a unique domain name.

To set the main domain name for an existing website:

  1. Open the Sites application.
  2. Edit () the site.
  3. Type the domain into the Site domain name property on the General tab.
  4. Click Save.

Domain name format

Enter the domain name without the URL scheme (protocol) and www prefix. Include the port number if it is different than 80.

Correct:

  • mycompany.com
  • partners.mycompany.com
  • mycompany.com:8080

Incorrect:

  • http://mycompany.com
  • www.mycompany.com

Setting the domain for content-only sites

If your site is a content-only site, you need to set a URL leading to the live site's domain. This is required for many features when developing MVC sites, such as preview mode and the page builder.

  1. Open the Sites application.
  2. Edit your site.
  3. On the General tab, type the URL leading to the site's domain into the Presentation URL property.

    • The value must include the URL scheme (protocol). If the site is hosted in a virtual directory, include it as well. For example:

      https://www.SiteDomain.com or http://localhost/MvcApplication

  4. Click Save.

Note: You need to have a valid license for the domain in the Presentation URL.

Links on the live site will now be resolved with the domain you entered. Note that Kentico cannot guarantee that links used (clicked on) directly on the Page tab of the Pages application will resolve correctly when using this property.

Adding domain aliases

Domain aliases are alternative domain names that lead to the same website. You can add any number of domain aliases for each site. For example, if your website uses mycompany.com as its main domain and you also wish to assign the my-company.co.uk domain to the same website, you need to create a domain alias. Aliases can be particularly useful when building multilingual websites.

To create a domain alias for your website:

Note: You need to have a valid license for every domain alias. Domain alias licenses are free of charge if you already own a license for the main domain.

  1. Open the Sites application.
  2. Edit your site.
  3. Select the Domain aliases tab.
  4. Click New domain alias.
  5. Type the alternative domain name into the Domain alias property.

    • Use the same format as for the site's main domain name, without the protocol or www prefix.

  6. (Optional) Set the Default alias path.
    • Specifies the default page that the system displays when users access the site's root URL through the domain alias.
    • Overrides the Settings -> Content -> Default alias path setting.
  7. Click Save.

The site is now available under the alias's domain name.

Redirecting aliases to the main domain

You can configure domain aliases to automatically redirect users to another URL. When a visitor accesses the website through the domain alias, the system sends them to the specified URL instead.

If the only purpose of your domain aliases is to make the site available under multiple domain names, it is recommended to redirect the aliases to the website's main domain. This is a common Search engine optimization practice that prevents duplicate web content (i.e. having multiple URLs leading to the same content).

To set up redirection for your domain aliases:

Configure the redirect URL

  1. Open the Sites application.
  2. Edit your site.
  3. Select the Domain aliases tab.
  4. Edit your aliases.
  5. Type the target URL into the Redirect URL property.

    The Redirect URL property supports only absolute URLs. Use macro expressions to dynamically redirect users to the correct page, for example: {%protocol%}://domain.com{%relativepath%} .

    • {% protocol %} - resolves into the current URL scheme name (protocol) when the redirection takes place
    • {% relativepath %} - resolves into the current relative URL path when the redirection takes place
  6. Click Save.

(Optional) Configure output caching for the domain variable

If you are using a Default alias path for any of the domain aliases, you need to make the output cache store different data based on the different domains.

  1. Open the Settings application.
  2. Go to System -> Performance.
  3. Under Output caching, enable Output cache variables - domain.
  4. Save.

The system now automatically redirects all users to the site's main domain. For example, if your site's main domain is domain.com and you have domain.co.uk as a domain alias, users who access https://domain.co.uk/example.aspx are redirected to https://domain.com/example.aspx.


Was this page helpful?