User Tools

Site Tools


web:password-protected:force_https

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
web:password-protected:force_https [2017/12/20 09:30] – created jasweb:password-protected:force_https [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-====== Forcing Page Access to https:// ====== 
- 
-If your web page is requesting a password, it is best to send the password over an encrypted channel. 
- 
-Before your authentication block, add this code to redirect http://URL to https://URL: 
- 
-<code> 
-RewriteEngine On 
-RewriteCond %{HTTPS} off 
-RewriteRule ^/?(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] 
-</code> 
- 
-Surrounding your authentication block, add this condition which forces authentication to only occur when your page is served over https: 
- 
-<code> 
-<If "%{HTTPS} == 'on'"> 
-  <Your authentication block> 
-</If> 
-</code> 
- 
-That's all you need to do!  Putting it together, here's an example: 
- 
-<code> 
-RewriteEngine On 
-RewriteCond %{HTTPS} off 
-RewriteRule ^/?(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] 
- 
-<If "%{HTTPS} == 'on'"> 
-  AuthType Basic 
-  AuthName "My Page" 
-  AuthBasicProvider pam 
-  require valid-user 
-</If> 
-</code> 
  
web/password-protected/force_https.1513780248.txt.gz · Last modified: 2017/12/20 09:30 by jas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki