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 EricCovener:
http://wiki.apache.org/httpd/RewriteHTTPToHTTPS

------------------------------------------------------------------------------
  
  === Fix : ===
  
- '''Entire site (httpd.conf) :'''
  {{{
  RewriteEngine On
  # This will enable the Rewrite capabilities
@@ -20, +19 @@

  RewriteCond %{HTTPS} !=on
  # This basically checks to make sure the connection is not already HTTPS
  
- RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
+ RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
  # This rule will redirect users from their original location, to the same 
location but using HTTPS.
  # i.e.  http://www.example.com/foo/ to https://www.example.com/foo/
  }}}
@@ -28, +27 @@

  
  '''Entire site (.htaccess) :'''
  
- ''Note:  You will need to ensure that you place this in a .htaccess file in 
the root of the site you want to apply it against, and to make sure you have 
the appropriate !AllowOverride configuration in your httpd.conf''
+ ''Note:  While the rules you need are the same as above (because the rule 
above doesn't depend on any of the quirks of rewrite in .htacess), you will 
need to ensure that you place this in a .htaccess file in the root of the site 
you want to apply it against, and to make sure you have the appropriate 
!AllowOverride configuration in your httpd.conf''
- {{{
- RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]
- # This rule will redirect users from their original location, to the same 
location but using HTTPS.
- # i.e.  http://www.example.com/foo/ to https://www.example.com/foo/
- }}}
  
+ '''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.''
- '''Specific Directory (httpd.conf)'''
- 
- ''Note:  This will need to be added to an appropriate <Directory> block.''
  {{{
  RewriteEngine On
  # This will enable the Rewrite capabilities
@@ -46, +39 @@

  RewriteCond %{HTTPS} !=on
  # This basically checks to make sure the connection is not already HTTPS
  
- RewriteRule ^/secure(.*) https://%{SERVER_NAME}/secure$1 [R,L]
+ RewriteRule ^(.*) 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.
  }}}
  
- 
- '''Specific Directory (.htaccess)'''
- 
- ''Note:  This htaccess file will need to be saved in the appropriate 
directory.  Again you need to make sure that you have the correct 
!AllowOverride settings in place''
- {{{
- RewriteEngine On
- # This will enable the Rewrite capabilities
- 
- RewriteCond %{HTTPS} !=on
- # This basically checks to make sure the connection is not already HTTPS
- 
- 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/
- }}}
- 

Reply via email to