Force https

Section 9 deals with forcing HTTPS. Assuming an SSL certificate is installed, it is strongly recommended that https be enabled as it is now a best practice, even on sites that don't handle sensitive data.

To force HTTPS, uncomment section 9a:

RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Note: if using certbot for SSL, the certbot tool may have already https in the relevant Apache configuration file, therefore this step may be unnecessary, but still recommended.


Previous Next

Episode #
3 of 7
Course
.htaccess File

ProCache: v405 Render date: 2025-12-06 04:51:29 Page render time: 0.1020s Total w/ProCache: 0.1024s