Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using the option for redirecting all domain aliases to one of the aliases. However, when using the "SSL required" option, the redirect is ignored and if you go to the HTTP address, you will be redirected to the original domain name (x.y.z).
The problem seems to be the HTTPS rewrite rule:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/*(.*)$ https://x.y.z/$1 [NE,L,R=301]
RewriteRule ^/files/(.*)$ /sites/x.y.z/files/$1 [L]
RewriteCond /www/aegir/hostmaster-7.x-3.1/sites/x.y.z/files/robots.txt -f
RewriteRule ^/robots.txt /sites/x.y.z/files/robots.txt [L]
</IfModule>
A fix seems to be to adjust it as follows:
RewriteRule ^/*(.*)$ https://%{HTTP_HOST}/$1 [NE,L,R=301]
Comment | File | Size | Author |
---|---|---|---|
#3 | provision-redirect_domain_and_ssl_required_fix-3.patch | 682 bytes | captainack |
Comments
Comment #2
captainack CreditAttribution: captainack commentedI just noticed this on 3.2 too.
Comment #3
captainack CreditAttribution: captainack commentedLooks like there was a typo in the vhost template
Comment #4
ergonlogicThe documentation for that clause clearly states: "redirect all aliases + main uri to the main https uri." So, at very least the docs would have to be fixed there.
But really, I think we need to re-work the muddled logic in that template. Ignoring the actual implementations, the logic currently looks something like:
I don't think the outside if-then does anything worthwhile, while the inner ones, by combining criteria, make this much harder to parse than it ought to be. I believe the following would be functionally equivalent, but much clearer:
Alternatively, this might be clearer:
Comment #5
colanI can't reproduce this on Nginx with Aegir HTTPS. But maybe it's still a problem for Apache?
Comment #6
Jon PughThis still needs to be fixed.
I get double redirects when using required HTTPS and domain aliases (which is always now).
The port 80 apache config redirects to the "main" URL, but it should redirect straight to the redirect destination:
See " # Redirect all aliases + main uri to the main https uri."
Existing:
Comment #9
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commented@Jon Pugh The patch from #3 seems to fix this. I've now committed it. And I've changed 'main uri' to 'the selected alias' ... matching with what we have in hosting_https.
Comment #10
Jon PughSweet, thanks helmo and captainack!