Commit 5742e4c9 authored by Marius Cramer's avatar Marius Cramer

Fixed: FS#3581 - Website unaccessible under some circumstances when using seo...

Fixed: FS#3581 - Website unaccessible under some circumstances when using seo redirection *.domain to www.domain
(only for apache2, nginx still to do)
parent 31895e66
...@@ -339,10 +339,12 @@ ...@@ -339,10 +339,12 @@
<tmpl_if name="rewrite_enabled"> <tmpl_if name="rewrite_enabled">
RewriteEngine on RewriteEngine on
<tmpl_if name='seo_redirect_enabled'> <tmpl_if name='seo_redirect_enabled'>
RewriteCond %{HTTP_HOST} <tmpl_var name='seo_base_domain'>$ [NC]
RewriteCond %{HTTP_HOST} <tmpl_var name='seo_redirect_operator'>^<tmpl_var name='seo_redirect_origin_domain'>$ [NC] RewriteCond %{HTTP_HOST} <tmpl_var name='seo_redirect_operator'>^<tmpl_var name='seo_redirect_origin_domain'>$ [NC]
RewriteRule ^(.*)$ http<tmpl_if name='ssl_enabled'>s</tmpl_if>://<tmpl_var name='seo_redirect_target_domain'>$1 [R=301,L] RewriteRule ^(.*)$ http<tmpl_if name='ssl_enabled'>s</tmpl_if>://<tmpl_var name='seo_redirect_target_domain'>$1 [R=301,L]
</tmpl_if> </tmpl_if>
<tmpl_loop name="alias_seo_redirects"> <tmpl_loop name="alias_seo_redirects">
RewriteCond %{HTTP_HOST} <tmpl_var name='alias_seo_base_domain'>$ [NC]
RewriteCond %{HTTP_HOST} <tmpl_var name='alias_seo_redirect_operator'>^<tmpl_var name='alias_seo_redirect_origin_domain'>$ [NC] RewriteCond %{HTTP_HOST} <tmpl_var name='alias_seo_redirect_operator'>^<tmpl_var name='alias_seo_redirect_origin_domain'>$ [NC]
RewriteRule ^(.*)$ http<tmpl_if name='ssl_enabled'>s</tmpl_if>://<tmpl_var name='alias_seo_redirect_target_domain'>$1 [R=301,L] RewriteRule ^(.*)$ http<tmpl_if name='ssl_enabled'>s</tmpl_if>://<tmpl_var name='alias_seo_redirect_target_domain'>$1 [R=301,L]
</tmpl_loop> </tmpl_loop>
......
...@@ -2951,6 +2951,8 @@ class apache2_plugin { ...@@ -2951,6 +2951,8 @@ class apache2_plugin {
$seo_redirects[$prefix.'seo_redirect_target_domain'] = $web['domain']; $seo_redirects[$prefix.'seo_redirect_target_domain'] = $web['domain'];
$seo_redirects[$prefix.'seo_redirect_operator'] = '!'; $seo_redirects[$prefix.'seo_redirect_operator'] = '!';
} }
$seo_redirects[$prefix.'seo_base_domain'] = str_replace('.', '\.', $web['domain']);
return $seo_redirects; return $seo_redirects;
} }
......
...@@ -2842,6 +2842,8 @@ class nginx_plugin { ...@@ -2842,6 +2842,8 @@ class nginx_plugin {
$seo_redirects[$prefix.'seo_redirect_operator'] = '!='; $seo_redirects[$prefix.'seo_redirect_operator'] = '!=';
} }
} }
$seo_redirects[$prefix.'seo_base_domain'] = str_replace('.', '\.', $web['domain']);
return $seo_redirects; return $seo_redirects;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment