| 
 
 
 | 
| Keep Server Online 
 If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
 
 or
 
 
   
 A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
 
 Thank You! Steffen
 
 Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
 |  | 
 | 
| | 
| | 
|  Topic: All Server over https |  |  
| Author |  |  
| hugomsgomes 
 
 
 Joined: 24 Sep 2007
 Posts: 2
 Location: Portugal
 
 | 
|  Posted: Mon 24 Sep '07 11:22    Post subject: All Server over https |   |  
| 
 |  
| Hi 
 I´m new in config's of Apache, but now i have a server that i need to configure all under HTTPS, but it only work if i have http and https, this means if i write http:// i have access to my site, and i want that even if users write http://.... the apache redirect them automatic to https:// .... but i couldn't find out how i do that!!!
 
 I've tried the alias / "https://www.mysite.com" and redirect / "https://www.mysite.com" but didn't worked !!!
 
 If anyone could help me i'll apreciate.
 
 With the best regards,
 
 Hugo Gomes
 |  |  
| Back to top |  |  
| SabinF 
 
  
 Joined: 03 May 2006
 Posts: 37
 Location: Timisoara (Romania)
 
 | 
|  Posted: Mon 24 Sep '07 13:46    Post subject: |   |  
| 
 |  
| First you must enable "mod_rewrite". Then you must add the following in your "httpd.conf" file: 
 
  	  | Code: |  	  | RewriteEngine On ReWriteCond %{HTTPS} !=on
 RewriteRule .* https://%{HTTP_HOST}:443%{REQUEST_URI} [QSA,R=permanent,L]
 
 | 
 
 Of course this is available if you have enabled "mod_ssl".
   
 Or you can first test if "mod_ssl" is enabled and then do the rewrite:
 
 
  	  | Code: |  	  | <IfModule ssl_module> RewriteEngine On
 ReWriteCond %{HTTPS} !=on
 RewriteRule .* https://%{HTTP_HOST}:443%{REQUEST_URI} [QSA,R=permanent,L]
 </IfModule>
 
 | 
 |  |  
| Back to top |  |  
 
 | 
 |  | 
 |  |