Is it possible to define static rule for 301 redirect to canonical host name? I.e. I'd like what in Apache's mod_rewrite is done with:
# To force the use of
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.example.com/$1 [L,R=301]
I know I can do that in Python code, but I'd prefer to keep that separated.