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: v407 Render date: 2026-01-25 12:29:30 Page render time: 0.0860s Total w/ProCache: 0.0863s