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
This commit is contained in:
parent
cae1c5d786
commit
555be63708
|
@ -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)
|
||||
|
|
Reference in New Issue