Domain names

Domain names are text-based addresses identifying online locations, such as websites. They provide a more memorable and recognizable way for people to navigate the internet than numerical IP addresses.

A newly installed database is usually reachable through the address assigned by your hosting provider (e.g., mycompany.example-hosting.com). To let visitors reach your website through your own address (e.g., www.yourdomain.com), configure a domain name you own.

Note

Registering a domain name and managing its DNS records is done at your domain registrar, not in Odoo. If you are unsure which registrar or DNS service hosts your domain, contact your hosting provider or system administrator.

DNS records

The following DNS record types are relevant when connecting a domain name to a database:

  • A: an A record holds the IP address a domain points to.

  • CNAME: CNAME records forward one domain or subdomain to another domain. This is the record type used to point the www. subdomain to the database.

  • MX: MX records instruct servers on where to deliver emails sent to the domain.

  • TXT: TXT records are used for different purposes (e.g., to verify domain name ownership, or to publish the SPF and DKIM records used for outgoing emails).

Any modification to the DNS records can take up to 72 hours to propagate worldwide on all servers.

Mailbox

Connecting a domain name to a database does not create mailboxes for that domain. To receive emails at addresses such as [email protected], either use a subdomain as an alias domain for the database, or set up an external email provider.

Use a subdomain

You can create a subdomain (e.g., subdomain.yourdomain.com) to use as an alias domain for the database. It allows users to create records in the database from emails received on their [email protected] alias.

To do so, add a CNAME record at your DNS provider with the desired subdomain as the name (e.g., subdomain) and the database’s original address with a period at the end as the target (e.g., mycompany.example-hosting.com.). Then, ask your hosting provider to declare the subdomain as an additional domain of the database.

Finally, go to your database and open Settings. Under the Alias Domain field, enter the alias domain (e.g., subdomain.yourdomain.com), click Create, and then Save.

Use an external email provider

To use an external email provider, configure an MX record at your DNS provider. The values to enter for the Name, Content, and Priority fields depend on the external email provider.

Configure an existing domain name

If you already have a domain name, you can use it for your Odoo website.

Warning

It is strongly recommended to follow in order these steps to avoid any SSL certificate validation issues:

  1. Add a CNAME record

  2. Redirect your naked domain name (optional, but recommended)

  3. Map your domain name to your Odoo database

  4. Map your domain name to your Odoo website

Add a CNAME record

Adding a CNAME record to forward your domain name to the address of your Odoo database is required. The CNAME record’s target address is the database’s address as provided by your hosting provider (e.g., mycompany.example-hosting.com).

The specific instructions depend on your DNS hosting service.

Redirect a naked domain

Note

Although optional, completing this step is advised.

To let visitors use your naked domain name (a domain name without any subdomains or prefixes) (yourdomain.com), creating a 301 redirect (a permanent redirect from one URL to another) to www.yourdomain.com is required:

  • from http://yourdomain.com to https://www.yourdomain.com, and

  • from https://yourdomain.com to https://www.yourdomain.com.

The specific instructions depend on your DNS hosting service. However, not all of them offer to redirect a naked domain with a secure HTTPS connection. If you encounter any issue, we recommend using Cloudflare.

Using Cloudflare to secure and redirect a naked domain

  1. Sign up and log in to Cloudflare.

  2. Enter your domain name on Cloudflare’s dashboard and select Quick scan for DNS records.

  3. Choose a plan (the free plan is sufficient).

  4. Follow Cloudflare’s instructions and recommendations to complete the activation.

  5. Add a CNAME record to redirect your naked domain (yourdomain.com) to the www subdomain (e.g., www.yourdomain.com) by clicking DNS in the navigation menu, then clicking the Add record button, and using the following configuration:

    • Type: CNAME

    • Name: @ (or yourdomain.com)

    • Target: e.g., www.yourdomain.com

    • Proxy status: Proxied

    screenshot: websites-domain-names-cloudflare-cname-www
    menu
    (Cloudflare dashboard) ‣ DNS ‣ Records ‣ Add record
    shows
    The Cloudflare "Add record" form filled in with Type CNAME, Name "@", Target "www.yourdomain.com" and Proxy status "Proxied".
    highlight
    The Type, Name, Target and Proxy status fields (red frame).
    data
    Example domain "yourdomain.com".
    module
    (external website)
    notes
    English UI, light theme, 1440px width, crop to the record form.
  6. Add another second CNAME record to redirect the www subdomain (e.g., www.yourdomain.com) to your database address (e.g., mycompany.example-hosting.com) using the following configuration:

    • Type: CNAME

    • Name: e.g., www.yourdomain.com

    • Target: e.g., mycompany.example-hosting.com

    • Proxy status: DNS only

    screenshot: websites-domain-names-cloudflare-cname-db
    menu
    (Cloudflare dashboard) ‣ DNS ‣ Records ‣ Add record
    shows
    The Cloudflare "Add record" form filled in with Type CNAME, Name "www", Target the database address, and Proxy status "DNS only".
    highlight
    The Proxy status toggle set to "DNS only" (red frame).
    data
    Example domain "yourdomain.com", database address "mycompany.example-hosting.com".
    module
    (external website)
    notes
    English UI, light theme, 1440px width, crop to the record form.
  7. Define a redirect rule to permanently redirect (301) your naked domain (e.g., yourdomain.com) to both http:// and https:// by going to Rules ‣ Create rule ‣ Products, and clicking Create a Rule under Redirect Rules:

    • Enter any Rule name.

    • Under the If incoming requests match… section, select Custom filter expression and use the following configuration:

      • Field: Hostname

      • Operator: equals

      • Value: e.g., yourdomain.com

    • Under the Then… section, use the following configuration:

      • Type: Dynamic

      • Expression: e.g., concat("https://www.yourdomain.com", http.request.uri.path)

      • Status code: 301

      • Preserve query string: enabled

    screenshot: websites-domain-names-cloudflare-redirect-rule
    menu
    (Cloudflare dashboard) ‣ Rules ‣ Redirect Rules ‣ Create a Rule
    shows
    The Cloudflare redirect rule form with a custom filter expression on Hostname equals "yourdomain.com" and a dynamic expression producing "https://www.yourdomain.com" with status code 301 and "Preserve query string" enabled.
    highlight
    The "Then..." section with the dynamic expression and the 301 status code (red frame).
    data
    Example domain "yourdomain.com".
    module
    (external website)
    notes
    English UI, light theme, 1440px width, full rule form.
  8. Go to SSL/TLS and set the encryption mode to Full.

    screenshot: websites-domain-names-cloudflare-encryption
    menu
    (Cloudflare dashboard) ‣ SSL/TLS ‣ Overview
    shows
    The Cloudflare SSL/TLS encryption mode page with "Full" selected.
    highlight
    The "Full" encryption mode option (red frame).
    data
    Example domain "yourdomain.com".
    module
    (external website)
    notes
    English UI, light theme, 1440px width, crop to the encryption mode selector.

Map a domain name to an Odoo database

Warning

Ensure you have added a CNAME record to your domain name’s DNS before mapping your domain name to your Odoo database.

Failing to do so may prevent the validation of the SSL certificate and could result in a certificate name mismatch error. Web browsers often display this as a warning, such as “Your connection is not private”.

Once the CNAME record points to the database, ask your hosting provider or system administrator to declare the domain name (e.g., www.yourdomain.com) as a domain served by the database, so that the web server answers requests sent to that address and issues a certificate for it.

SSL encryption (HTTPS protocol)

SSL encryption allows visitors to navigate a website through a secure connection, which appears as the https:// protocol at the beginning of a web address rather than the non-secure http:// protocol.

A separate SSL certificate is generated for each domain name mapped to the database, usually through Let’s Encrypt’s certificate authority and ACME protocol.

Note

  • Certificate generation may take a few minutes to several hours, depending on the hosting setup.

  • Certificates are renewed automatically. If a browser reports an expired or mismatching certificate, contact your hosting provider or system administrator.

Important

No SSL certificate is generated for naked domains (domain names without any subdomains or prefixes).

Web base URL of a database

Note

If the Website app is installed on your database, skip this section and continue from the Map a domain name to a website section.

The web base URL or root URL of a database affects your main website address and all the links sent to your customers (e.g., quotations, portal links, etc.).

To make your custom domain name the web base URL of your database, access your database using your custom domain name and log in as an administrator (a user part of the Settings access right group under Administration).

Important

If you access your database with its original address (e.g., mycompany.example-hosting.com), the web base URL of your database is updated accordingly. To prevent the automatic update of the web base URL when an administrator logs in to the database, activate the developer mode, go to Settings ‣ Technical ‣ System Parameters ‣ New, and enter web.base.url.freeze as the Key and True as the Value.

Note

You can also set the web base URL manually. To do so, activate the developer mode, go to Settings ‣ Technical ‣ System Parameters, and search for the web.base.url key (create it if necessary) and enter the full address of your website as the value (e.g., https://www.yourdomain.com). The URL must include the protocol https:// (or http://) and not end with a slash (/).

Map a domain name to an Odoo website

Mapping your domain name to your website is different than mapping it to your database:

  • It defines your domain name as the main one for your website, helping search engines to index your website correctly.

  • It defines your domain name as the base URL for your database, including portal links sent by email to your customers.

  • If you have multiple websites, it maps your domain name to the appropriate website.

Go to Website ‣ Configuration ‣ Settings. If you have multiple websites, select the one you want to configure. In the Domain field, enter the address of your website (e.g., https://www.yourdomain.com) and Save.

screenshot: websites-domain-names-website-domain-setting
menu
Website ‣ Configuration ‣ Settings
shows
The Website settings page scrolled to the "Website Info" block, with the "Domain" field filled in with "https://www.yourdomain.com".
highlight
The "Domain" field (red frame).
data
Demo company "YourCompany"; a single website named "My Website".
module
website
notes
English UI, light theme, 1440px width, crop to the Website Info block.

Warning

Mapping your domain name to your Odoo website prevents search engines from indexing the database’s original address (e.g., mycompany.example-hosting.com).

If both addresses are already indexed, it may take some time before the indexation of the second address is removed. You can use the Google Search Console to fix the issue.

Note

If you have multiple websites and companies on your database, make sure to select the right Company under Website ‣ Configuration ‣ Settings. Doing so indicates Odoo which URL to use as the base URL according to the company in use.

Tip

When migrating from an existing website, make sure to set up the necessary redirects before adding your domain name. For example, if a previous URL like /path/about/something existed, redirect it to the new corresponding page on your Odoo website, such as /something.