Force http requests to the same location but securely using https with .htaccess file

user@server:/var/www/directory# cat /var/www/directory/.htaccess
RewriteEngine On
# This will enable the Rewrite capabilities

RewriteCond %{HTTPS} !=on
# This checks to make sure the connection is not already HTTPS

RewriteRule ^/?directory/(.*) https://%{SERVER_NAME}/directory/$1 [R,L]
# This rule will redirect all users who are using any part of /directory/ to the same location but using HTTPS.

Comments

Popular posts from this blog

Alternatives to: "The quick brown fox jumps over the lazy dog."

Using keys like ALT+TAB in UltraVNC.

Command-line installation of OpenVPN