You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wiki-changes@httpd.apache.org by Apache Wiki <wi...@apache.org> on 2009/08/14 20:40:47 UTC

[Httpd Wiki] Update of "RewriteHTTPToHTTPS" by RichBowen

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.

The following page has been changed by RichBowen:
http://wiki.apache.org/httpd/RewriteHTTPToHTTPS

------------------------------------------------------------------------------
  
  '''Specific Directory '''
  
- ''Note:  This will need to be added to an appropriate <Directory> block (wherever /secure/ maps to) if this is in httpd.conf. Otherwise, note the .htaccess caveats above.''
+ ''Either put the above solution in a .htaccess file in the directory to be affected, or put the URI prefix in the regex itself.''
  {{{
  RewriteEngine On
  # This will enable the Rewrite capabilities
@@ -39, +39 @@

  RewriteCond %{HTTPS} !=on
  # This basically checks to make sure the connection is not already HTTPS
  
- RewriteRule ^(.*) https://%{SERVER_NAME}/secure/$1 [R,L]
+ RewriteRule ^secure/(.*) https://%{SERVER_NAME}/secure/$1 [R,L]
  # This rule will redirect all users who are using any part of /secure/ to the same location but using HTTPS.
  # i.e.  http://www.example.com/secure/ to https://www.example.com/secure/
  # This means if you dont want to force HTTPS for all directories you can force it for a specific sub-section of the site.