Redirects

Forward one hostname to another hostname on the same Odoo service.

A redirect forwards visitors from one hostname to another hostname on the same Odoo service. This is useful when you move to a new domain, consolidate www and non-www addresses, or retire an old hostname while keeping its links working.

#How it works

When a hostname is set up as a redirect, hav.sh configures Traefik to answer requests for that hostname with an HTTP redirect instead of routing them to Odoo. The visitor's browser is sent to the target hostname, and the original path is preserved (e.g. old.company.com/shop redirects to new.company.com/shop).

You can choose between two redirect types:

Type Status code Use when
Permanent (301) 301 The move is permanent โ€” search engines update their index.
Temporary (302) 302 The move is temporary โ€” search engines keep the original.

#Step-by-step guide

#1. Add both hostnames to the service

Both the source hostname (the one being redirected) and the target hostname must already exist on the same Odoo service. Add them on the Hostnames tab if they aren't there yet โ€” see Adding a Domain.

#2. Edit the source hostname

  1. Navigate to your Odoo service
  2. Click the Hostnames tab
  3. Click Edit on the hostname you want to redirect
  4. Enable Redirect to another hostname
  5. Choose the Redirect target โ€” another hostname on this service
  6. Pick the Redirect type โ€” Permanent (301) or Temporary (302)
  7. Save

#3. Redeploy the service

The redirect is applied the next time the service is deployed, when Traefik's routing rules are regenerated.

A redirect only takes effect after you redeploy the service. Until then, the source hostname keeps routing to Odoo as before.

Visiting the source hostname now forwards to the target hostname over HTTPS, with the path preserved.

#Troubleshooting

The redirect target isn't in the list
  • The target must be another routed hostname on the same service โ€” add it on the Hostnames tab first.
    • A hostname that is itself a redirect cannot be used as a target.
    • A hostname cannot redirect to itself.
The redirect doesn't work yet
  • Redeploy the service so Traefik picks up the new routing rules.
    • Make sure the source hostname's DNS still points to the server, so the redirect can be served over HTTPS.