URL: http://reusablecode.blogspot.com/2008/04/force-ssl.html
There are some things here worth noting. We are checking if HTTPS is off. Some people will instead check if traffic is coming from port 80, the standard HTTP port, or not coming from 443, the standard HTTPS port. Checking port numbers is not the best solution because the server administrator can set up HTTP and HTTPS to run on different ports. It's also worth noting that QueryString variables are preserved, if any are being passed. Most other examples I've seen on the Internet ignore the QueryString variables, which leads to navigation problems.
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
You need to login to post a comment.
