From 555be63708e9dd6ba4a8e43572fe0eb7b9101472 Mon Sep 17 00:00:00 2001 From: jschneider Date: Mon, 12 Oct 2009 15:53:03 +0000 Subject: [PATCH] Use RedirectMatch instead of rewrite rules in apache configuration * larpe/admin/apache.py: use RedirectMatch and fix a rules when the homepage is redirect to the login page git-svn-id: svn+ssh://labs.libre-entreprise.org/svnroot/larpe@488 3ed937ae-f919-0410-9a43-8e6f19e4ba6e --- larpe/trunk/larpe/admin/apache.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/larpe/trunk/larpe/admin/apache.py b/larpe/trunk/larpe/admin/apache.py index 3fd607f..cb01760 100644 --- a/larpe/trunk/larpe/admin/apache.py +++ b/larpe/trunk/larpe/admin/apache.py @@ -276,20 +276,18 @@ class Location(object): conf_lines.append(self.python_path) if self.output_filters: conf_lines.append(self.output_filters) - # Enable rewrite module - if self.old_auth_url is not None or self.old_logout_url is not None: - conf_lines.append('RewriteEngine On') + # Redirect rules # Redirect old authentication url to the new one if self.old_auth_url is not None and self.host.auth_form_places == 'form_once': conf_lines.append( - 'RewriteRule %(old_auth_url)s %(new_auth_url)s [R]' % self.cfg) + 'RedirectMatch %(old_auth_url)s %(new_auth_url)s' % self.cfg) # Redirect old logout url to the new one if self.old_logout_url is not None: conf_lines.append( - 'RewriteRule %(old_logout_url)s %(new_logout_url)s [R]' % self.cfg) + 'RedirectMatch %(old_logout_url)s %(new_logout_url)s' % self.cfg) # Redirect the home page to the login page if self.host.redirect_root_to_login is True: - conf_lines.append('RewriteRule /$ %(new_auth_url)s [R]' % self.cfg) + conf_lines.append('RedirectMatch ^/$ %(new_auth_url)s' % self.cfg) # Convert urls in http headers to/from the new domain conf_lines.append('ProxyPass %(orig_url)s' % self.cfg) conf_lines.append('ProxyPassReverse %(orig_url)s' % self.cfg)