How to manage redirects in Django projects¶
Divio projects are HTTPS-ready by default, and we provide free SSL certificates on all projects.
To force redirect from HTTP to HTTPS in Django, set the SECURE_SSL_REDIRECT
environment variable to
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.