Added rewrite rules for non-canonical domains.
Changed check for production environment.