[BlueOnyx:26305] Re: HTTPS redirect
Michael Stauber
mstauber at blueonyx.it
Tue Jun 20 12:42:11 -05 2023
Hi Ken,
> I’m embarrassed to ask about an old 5208R system we have, obviously it
> is seriously out of date. So if you ignore me or yell at me, I will
> understand.
Nah, no yelling. It's high time to upgrade, but we all know how it goes. :o)
> I don’t particularly care what happens when someone types the IP address
> as the URL, but if they type www.domain.com, I’d like them to get
> https://www.domain.com just like when they type domain.com.
Yeah, with shared hosting the thing is that when someone goes to the IP
and there are multiple Vsites on it? They land on the first VirtualHost
that's configured in Apache for that IP.
For domain name redirects from HTTP to HTTPS a .htaccess is usually the
simplest option.
However, usage of .htaccess files is not allowed by default in Vsites by
default, as they can be used to reconfigure Apache and sometimes we
might not want that siteAdmins can do that.
So first go to "Server Management" / "Network Services" / "Web" and make
sure that under the grey heading "Options:" you have all checkboxes
ticked. You can leave "MultiViews" and "SymLinksIfOwnerMatch" unchecked.
Under "AllowOverride:" tick all checkboxes.
Then create a .htaccess in the /web directory of your Vsite and put the
following three lines into it:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
That should do it.
--
With best regards
Michael Stauber
More information about the Blueonyx
mailing list