Women in Technology

Hear us Roar



Article:
  Step by Step: Configuring SSL Under Apache
Subject:   Only a few pages need SSL under root folder
Date:   2010-05-22 06:37:18
From:   betol
Response to: Only a few pages need SSL under root folder

In the examples below, it is considered that your site is accessible at http://localhost/myapp/


#[1] all /myapp/user, /myapp/subscription and /myapp/login pages should be served in https


RewriteRule /myapp/user https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteRule /myapp/subscription https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteRule /myapp/login https://%{HTTP_HOST}%{REQUEST_URI} [R,L]



The following rules need to be put it in your <VitualHost *:443> section


#[2] For all other pages, if in https mode, serve the page in http mode.
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{REQUEST_URI} !^/myapp(/login|/user|/subscription)
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [L]


Hope this helps.