Redirect certain pages from http to https with .htaccess


The following trick is useful for E-Commerce sites.  We only need few pages redirected to https to secure transaction
This will automatically rewrite the url to https as long as the page is not already an https link. This conditional keeps it from causing a loop.
It’s very handy to have this capabilit thus allowing you to designate any page you want to be loaded with SSL security. Even if you type it without https.


RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^shop/(.*) <a href="https://%25/" rel="nofollow">https://%</a>{HTTP_HOST}/shop/$1 [R=301,L]

Note: change shop to your (e-commerce/forms) directory name. If you are using WordPress Permalinks, change shop to the parent page

%d bloggers like this: