To point your domain to Odoo, follow these steps:
Step 1 - Create a Domain Redirect
With a hosting plan at Hostinger
If you have a hosting plan at Hostinger, add the domain to your hosting plan. You can skip the onboarding and create an empty website.
Next, create an .htaccess file in the public_html folder of the domain and add the following code:
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteCond %{HTTP_HOST} ^(?:www.)?(.+)$ [NC]
Make sure to save the changes.
Without a hosting plan at Hostinger
If you have a domain only, you can create the redirect using Cloudflare by following this guide: How to Redirect a Domain Without a Hosting Plan.
Step 2 - Create the CNAME Record
Go to your domain's DNS Zone and delete any existing A records. Next, create a CNAME record with the following values:
Host: www
Points to: database.odoo.com
TTL: Default
Make sure to replace database with the name of your Odoo database:
For Odoo Online, it is the current address of your database. You can check it in the My databases section of your Odoo account
For Odoo.sh, go to Settings → Project Name on your Odoo account to find the name of the main address
NOTE:
If you used the Cloudflare method in the previous step, your DNS Zone management should be managed from there. You will need to create this CNAME record in Cloudflare
After applying these changes, wait for propagation to complete (up to 24 hours) before moving to the next step to prevent any SSL issues.
Step 3 - Map Your Domain With Your Database
The steps depend on your service type:
For Odoo online – go to your database manager, click on the settings button → Domain names, and select Use my own domain. Enter your domain name and click on Verify. Next, click on I confirm, it’s done.
For Odoo.sh – go to Branches → select your branch → Settings → Custom domains. Enter your domain name and click on Add domain.
Step 4 - Update the Database Root URL
Activate the developer mode on your Odoo account, then go to Settings → Technical → System Parameters.
Find the web.base.url key, or create it if it does not exist, and enter your domain name with the following format:
https://www.domain.tld
Make sure to include the protocol (HTTPS) and remove any slash at the end (/).
Once your database root URL is updated, create the following system parameter to prevent it from reverting automatically:
Key: web.base.url.freeze
Value: True
Step 5 - Map your Domain With your Website
On your Odoo account, go to Website → Configuration → Settings → Website Info and select the desired website.
Once there, enter your domain name in the Domain field with the following format:
https://www.domain.tld
And click Save.
That’s it! Now you know how to point your domain to Odoo 😊
Additional resources:
If you encounter any issues pointing your domain after creating the redirect and adding the correct CNAME record, please get in touch with Odoo support