---
title: Setting domain names for sites
related:
  - https://docs.kentico.com/k12sp/configuring-kentico/search-engine-optimization.md
  - https://docs.kentico.com/k12sp/multilingual-websites/setting-up-multilingual-websites/setting-default-languages-for-users-and-visitors.md
  - https://docs.kentico.com/k12sp/multilingual-websites/setting-up-multilingual-websites/configuring-urls-for-multilingual-websites.md
  - https://docs.kentico.com/k12sp/developing-websites/defining-website-content-structure/creating-and-configuring-page-types/configuring-page-types/specifying-the-url-pattern-for-content-only-pages.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

The [Domain name](http://en.wikipedia.org/wiki/Domain_name) is one of the basic properties that you assign when [creating new sites](https://docs.kentico.com/k12sp/configuring-kentico/managing-sites/installing-new-sites.md). 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. If necessary, sites can share the same basic domain name, but the values cannot be completely identical (for example, the difference can be in the virtual directory or URL path component).

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**.

> **Info:** **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

For content-only sites, you need to set a URL leading to the live site's domain. This is required for many features when [developing MVC sites](https://docs.kentico.com/k12sp/developing-websites/mvc-development-overview.md), 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:** **Note**: You need to have a valid [license](https://docs.kentico.com/k12sp/configuring-kentico/managing-sites/managing-site-licenses.md) 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.

## Domain names for local development

When running or debugging your website locally during development (for example using the built-in web server in Visual Studio), you need to use the domain names assigned to your site in Kentico.

- You can adjust the _Project URL_ of your project accordingly in your development environment (Visual Studio).
- If you wish to run on a _localhost_ domain, but your site has a different domain name assigned, you need to add _localhost_ as a [domain alias](#adding-domain-aliases).

## Adding domain aliases

Domain aliases are alternative domain names that lead to the same website. Aliases can be used for the domains of **Portal Engine sites**. For content-only (MVC) sites, domain aliases only apply to the administration interface "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](https://docs.kentico.com/k12sp/multilingual-websites.md).

To create a domain alias for your website:

> **Note:** **Note**: You need to have a valid [license](https://docs.kentico.com/k12sp/configuring-kentico/managing-sites/managing-site-licenses.md) 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](https://docs.kentico.com/k12sp/configuring-kentico/search-engine-optimization.md) 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.

   > **Info:** The **Redirect URL** property supports only absolute URLs. Use [macro expressions](https://docs.kentico.com/k12sp/macro-expressions.md) 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_.
