Dear Wiki user,

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

The "RedirectSSL" page has been changed by jmcg:
http://wiki.apache.org/httpd/RedirectSSL?action=diff&rev1=27&rev2=28

- (!) '''THIS IS A SCRATCHPAD DOCUMENT, PLEASE CONSIDER THIS WHEN READING ON''' 
(!)
- 
  ## page was renamed from ScratchPad/RedirectSSL
  = Redirect Request to SSL =
  Let's say you want http://www.example.com/secure/ to always be sent over SSL 
(I presume here that both the normal and the SSL vhost have the same content). 
You could do this by linking to the correct page from within your HTML pages... 
but there will always be some user who will sneak by it that way.
@@ -10, +8 @@

  
  ----
  
- === Using virtual hosts (using redirect) ===
+ == Using virtual hosts (using redirect) ==
  When using SSL, you will frequently have at least two virtual hosts: one on 
port 80 to serve ordinary requests, and one on port 443 to serve SSL.  If you 
wish to redirect users from the non-secure site to the SSL site, you can use an 
ordinary 
[[http://httpd.apache.org/docs/trunk/mod/mod_alias.html#redirect|Redirect]] 
directive inside the non-secure VirtualHost:
  
  {{{
@@ -28, +26 @@

  # etc...
  </VirtualHost>
  }}}
+ 
+ When redirecting everything you don't even need a !DocumentRoot:
+ {{{
+ NameVirtualHost *:80
+ <VirtualHost *:80>
+    ServerName www.example.com
+    Redirect permanent / https://secure.example.com/
+ </VirtualHost>
+ 
+ <VirtualHost _default_:443>
+    ServerName secure.example.com
+    DocumentRoot /usr/local/apache2/htdocs
+    SSLEngine On
+ # etc...
+ </VirtualHost>
+ }}}
+ 
+ 
  '''Note:''' redirect can also be used inside .htaccess files or to address 
particular URLs, as in:
  
  Example:
@@ -36, +52 @@

  }}}
  
  
- === Using mod_rewrite ===
+ == Using mod_rewrite ==
  While the {{{<VirtualHost>}}} solution is recommended because it is simpler 
and safer, you can also use mod_rewrite to get the same effect as described 
here: [[RewriteHTTPToHTTPS]]
   
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to