Rodolfo Bandeira

Rodolfo Bandeira

software, electronics, security, devops, thoughts

How to redirect all http to https in your Apache

How to redirect all http to https in your Apache?

Just edit your httpd.conf in the VirtualHost section and put this code:

<VirtualHost *:80>
    ServerAdmin YOUR_EMAIL_ADMIN_HERE
    DocumentRoot /var/www
    ServerName YOUR_SERVER_DOMAIN_HERE
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

Rodolfo

Last modified:

LinkedIn
WhatsApp