Issue
I'm looking to redirect any web request to HTTP to HTTPS in apache and I have a working solution that I have added to my httpd.conf file:
<VirtualHost *:80>
ServerName myhostname.com
Redirect / https://myhostname.com/
</VirtualHost>
this solution however is host-name dependent and I would like to know if there's a host-name independent method.
I tried using ${HOST_NAME}
but it didn't work I guess the variable needs to be set before hand.
Solution
<VirtualHost *:80>
ServerName myhostname.com
</VirtualHost>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
This redirect your whole site, means every http request will be redirected, is this what you want?
Answered By - UFe Answer Checked By - Gilberto Lyons (WPSolving Admin)