I use an in-house content management system written using PHP and running on Apache and Linux. The CMS has an install routine that automatically creates a .htaccess file that forces the redirect of http to https for all new isntallations. This is all good if https is installed on that domain, but my question is, how can I modify the test so that .htaccess only forwards to https if https is available for that domain?
The important part of the .htaccess file:
# Redirect users from http: to https:
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,QSA]
Okay, well the way to do it is first not to use mod_rewrite
(pursing to https://httpd.apache.org/docs/2.4/rewrite/avoid.html) and use Redirect
in its place:
Redirect "/" "https://www.example.com/"