How do I set up redirection between www and non-www domains?
Redirection is not a requirement at all. However, it might be needed in some cases. For example:
- the web server might accept Host headers only for www.mimosa.com and not mimosa.com (or vice-versa).
- if the website uses SSL, the certificate might be bound to one domain but not to the other.
In these cases, the web server throws a 301 (permanent redirect) response and leads to browser to the other domain.
We'll use the example of a website with the domain mimosa.com. There are actually two domains for the site – mimosa.com and www.mimosa.com. Let's assume mimosa.com is being redirected to www.mimosa.com.
To continue this redirection with Instart's Digital Experience Management Platform in between, there are two ways to do it:
- We will provide a CNAME for www.mimosa.com and therefore all requests to www.mimosa.com will flow through us. Requests to mimosa.com will continue going to the origin and, upon getting a 301, will hit the Instart proxies.
We can also handle both mimosa.com and www.mimosa.com. In that case, we can provide an A record for mimosa.com (since root domains can't use a CNAME). When the request hits a Instart proxy, we do the redirection to www.mimosa.com instead of this needing to be done from the origin server.
Note that this is not possible if there are any POST requests to the domain which is going to be redirected. POST requests can't be redirected and will fail. In this case traffic needs to be sent as-is to the origin for both www and non-www domains.
If you have any questions, please contact Support.