How to Redirect HTTP to HTTPS with an .htaccess File

Here is how to redirect HTTP to HTTPS on Apache Server with an .htaccess file:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R=301,L]

If you have questions or it doesn’t work, please leave a comment below.

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *