Connecting Tech Pros Worldwide Forums | Help | Site Map

VirtualHost Redirect to HTTPS, SSLRequireSSL? ModRewrite?

dlite922's Avatar
Expert
 
Join Date: Dec 2007
Location: Moon, Dark Side
Posts: 1,095
#1: Jul 3 '08
I need help with redirecting virtualhosts to use HTTPS (SSL) when they type in HTTP

Must work in IE.

Right now there is two virtual host blocks for every subdomain.

I want to combine the virtual hosts so that I don't have one for port 80 (which basically gives you a page that says type https, UGH! ugly!), and one for port 443

Current Config:
Expand|Select|Wrap|Line Numbers
  1. <VirtualHost x.x.x.x:80>
  2.     ServerName sub1.example.com
  3.     DocumentRoot...
  4.     DirectoryIndex...
  5. </VirtualHost> 
  6.  
  7. <VirtualHost x.x.x.x:443>
  8.     ServerName sub1.example.com
  9.     SSL Engine on
  10.     SSLCertificateFile ...
  11.     SSLCertificateKeyFile...
  12.     SSLCertificateChainFile...
  13.     DocumentRoot...
  14.     DirectoryIndex...
  15. </VirtualHost> 
  16.  
  17.  
  18.  
  19.  
  20.  
How can I combine those to that if someone types in HTTP it redirects to HTTPS.

(I know its ModRewrite but I don't know how, GoogleSearch examples were confusing. )

SSLRequireSSL gives you an access denied page if not SSL?

thanks in advance,



Dan

Reply