You will find various redirects at work on URLs in Divio Cloud projects.
They fall into different categories:
- Protocol redirects (e.g. from HTTP to HTTPS)
- Domain name redirects (e.g.
- Language redirects (e.g.
All are by default
302 Temporary Redirects.
Our projects are HTTPS-ready by default, and we provide free SSL certificates even on free projects.
Adding a SECURE_SSL_REDIRECT will enable these redirects.
Domain name redirects¶
You can set up your site’s domains using the Domains section of the Control Panel. This includes the ability to set a primary and secondary domains. The secondary domains can each be set to redirect to the primary domain if required.
The domains that are to be redirected to the primary domain can also be managed manually, via DOMAIN_REDIRECTS.
Django provides redirection to the the default language URL when none is specified. (In addition, django CMS offers complex fallback options for unavailable languages.)
/about will redirect to
/en/about if English is the
aldryn-django can be configured to not use the prefix for the default language, by checking the Remove URL language prefix for default language checkbox on the settings for the Aldryn Django addon in the Control Panel.
301 Permanent vs 302 Temporary redirects¶
You will sometimes see online site-checking tools encouraging the use of permanent redirects and even flagging temporary redirects as an issue. It is true that a permanent redirect is sometimes more appropriate, but only when it really should be permanent, and is guaranteed not to change.
Protocol, domain and language directs are
302 Temporary by default.
Permanent redirects are cached by browsers - some even update their bookmarks
if they encounter a
301. This can cause problems if the redirects change,
potentially causing redirect loops for users (which site owners will not be
able to replicate).
However, we do offer a setting ALDRYN_SITES_REDIRECT_PERMANENT to force permanent redirects for protocol and domain directs. This is to be used with caution.