I am running a multisite Drupal 8.5.3 installation on Apache under FreeBSD and I'm finding that when you access http://xyz.com the browser is instructed to redirect to http://www.xyz.com. I don't want this to occur. The really strange thing is that this behaviour does not occur when you access https://xyz.com
The default .htaccess file has this redirection disabled by default and there are no rules in the Apache configuration file that is forcing the redirection to occur so I'm at a bit of a loss and hoping that someone can give me some pointers on where to look.
The end goal is for each http:// site to be redirected to the https:// site but for whatever reason I cannot get this to work even though there are plenty of examples explaining what to do. I presume that it is because something in my environment is causing the redirect to http://www.xyz.com to occur before the rewrite rule to redirect to the https:// site can fire.
I only ever use the https:// version of each site and didn't notice that this was occuring. I've used multisites for some time on my own hardware but this environment is running on a hosting providers hardware and things are done differently within Apache. I've always created a virtual host for both the http:// and https:// variants of each site, but the hosting environment creates a single virtual host for http:// and another for https:// with each of the sites being aliases. I'm not sure if this is contributing to the issue or not.
I have had the Redirect module in operation to handle moved pages and the like but haven't ever used it for redirecting from http:// to https://
Thoughts anyone?
Thanks...Geoff
Comments
Further to this
I've been trying to think of other things which may help diagnose the problem.
I have a Google verification file installed and when .htaccess is installed it cannot be retrieved via http:// however when the .htaccess file is temporarily removed it can be retrieved.
Commenting out all the redirections in .htaccess does not appear to make a difference so I'm thinking that it might be something in the bowels of Drupal where my knowledge is not that deep.
I used to be able to access each of the sites via http:// but I think it stopped working after a Drupal update (around 8.3 possibly) although as previously mentioned I didn't pay much attention at the time because I typically use https:// to access the site.
This has been resolved. It
This has been resolved. It was a combination of the way in which the hosting provider set up the virtual hosts in Apache (which is much different to what I've used previously), Drupal being a bit too clever in the hosting environment, and me missing something obvious.
Essentially I didn't have ALL the server aliases configured as sites in my multisite Drupal installation. Once I put them all in place the website started working as expected.