To point your domain to Odoo, follow the steps below 👇
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 process 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 only have a domain (not a hosting plan), you can create the redirect with the help of Cloudflare: How to Redirect a Domain Without a Hosting Plan.
Step 2 – Create the CNAME Record
Access your domain's DNS zone and delete any existing A records. Then, create the following CNAME record:
Host: www
Points to: database.odoo.com
TTL: use the default value, e.g., 14400
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 in your Odoo account to find the name of the main address
NOTE
If you used the second option in Step 1, your domain's DNS zone should be managed from Cloudflare; i.e., you need to create these CNAME records in Cloudflare
Once you add the new DNS records, wait for propagation to complete (up to 24 hours), and your domain will start pointing to Odoo 😊
Step 3 – Map Your Domain With Your Database
The steps depend on the type of your service:
For Odoo online: go to your database manager, click on Settings → Domain names → Use my own domain; enter your domain name, click on Verify, and, finally, click on I confirm, it’s done
For Odoo.sh: go to Branches → select your branch → Settings → Custom domains; enter your domain name, and, finally, 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 in 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 on Save.
That’s it! Now you know how to point your domain to Odoo 😊
Additional Resources
If you encounter any issues with pointing your domain, please get in touch with Odoo support