How To Use .htaccess to Redirect HTTP Traffic to HTTPS

If your web host has implemented your new SSL certificate and everything else is in place and you are wondering how to redirect your HTTP traffic to HTTPS using a .htaccess file all you need to do is add this strip of code:

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

This goes right under:

RewriteEngine On

This is a common scenario when configuring WordPress to run on HTTPS.


Comments

Leave a Reply

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