How to force HTTPS using the .htaccess file in Apache

To force all web traffic to use HTTPS

RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

Table of Contents

Please enable JavaScript in your browser to complete this form.
Name

Send us your requirement

Please enable JavaScript in your browser to complete this form.
Your Requirements
(optional)