Artur Tyksinski - Sysadmin Blog

Artur Tyksinski - Sysadmin Blog


System Administration Blog by Artur Tyksinski. I talk about anything and everything technology. Mostly Virtualization, MSP, Cyber Security and Linux.

Share


Tags


avrt
Artur Tyksinski - Sysadmin Blog

Apache: Redirect HTTP to HTTPS

This short blog post covers how to redirect HTTP to HTTPS in Apache.

Artur TyksinskiArtur Tyksinski

Are you using Apache and want to redirect all HTTP requests to HTTPS? Look no further. Open an existing .htaccess file or create an .htaccess file in the root directory of the public folder for the domain you'd like to make the change to and enter the code below:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

You can read more about Redirecting HTTP to HTTPS on the Apache website located at https://wiki.apache.org/httpd/RewriteHTTPToHTTPS

View Comments