How can I force users to access my page over HTTPS instead of HTTP?

Mar 12, 2012   //   by   //   Blog, PHP Tutorial  //  No Comments

You could do it with a directive and mod_rewrite on Apache:

<Location /buy.php>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

You could make the Location smarter over time using regular expressions if you want.

Leave a comment

Share This Post

RSS Wordpress News