diff --git a/Provision/Config/Drupal/Alias/Store.php b/Provision/Config/Drupal/Alias/Store.php index 553aa57..f60fb90 100644 --- a/Provision/Config/Drupal/Alias/Store.php +++ b/Provision/Config/Drupal/Alias/Store.php @@ -16,10 +16,8 @@ class Provision_Config_Drupal_Alias_Store extends Provision_Config_Data_Store { function maintain() { $this->delete(); - if (!$this->redirection) { - foreach ($this->aliases as $alias) { - $this->records[$alias] = $this->uri; - } + foreach ($this->aliases as $alias) { + $this->records[$alias] = $this->uri; } } diff --git a/http/Provision/Config/Apache/vhost.tpl.php b/http/Provision/Config/Apache/vhost.tpl.php index f1c1e02..cf790be 100644 --- a/http/Provision/Config/Apache/vhost.tpl.php +++ b/http/Provision/Config/Apache/vhost.tpl.php @@ -35,14 +35,14 @@ if ($this->redirection || $ssl_redirection) { // redirect aliases in non-ssl to the same alias on ssl. print " RewriteRule ^/*(.*)$ https://%{HTTP_HOST}/$1 [NE,L,R=301]\n"; } - elseif ($ssl_redirection && $this->redirection) { + elseif ($ssl_redirection && $this->redirection && $this->redirection != $this->uri) { // redirect all aliases + main uri to the main https uri. print " RewriteRule ^/*(.*)$ https://{$this->uri}/$1 [NE,L,R=301]\n"; } - elseif (!$ssl_redirection && $this->redirection) { + elseif (!$ssl_redirection && $this->redirection && $this->redirection != $this->uri) { // Redirect all aliases to the main http url. - print " RewriteCond %{HTTP_HOST} !^{$this->uri}$ [NC]\n"; - print " RewriteRule ^/*(.*)$ http://{$this->uri}/$1 [NE,L,R=301]\n"; + print " RewriteCond %{HTTP_HOST} !^{$this->redirection}$ [NC]\n"; + print " RewriteRule ^/*(.*)$ http://{$this->redirection}/$1 [NE,L,R=301]\n"; } } ?>