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: Is there a setting or module for always use SSL protocol? |
|
Author |
|
JorgeCarousel
Joined: 14 Jul 2022 Posts: 15 Location: USA, New york
|
Posted: Thu 14 Jul '22 16:14 Post subject: Is there a setting or module for always use SSL protocol? |
|
|
Hi guys,
I have been dealing with websites built on Apache htpd on Windows and Linux and every time we want to make httpd to use https we have to do it in .htaccess with rewrite module, but is there a way to just enable ssl so it always uses it without having to use the rewrite module?
I'm asking because we are using web apps from third parties and they come with their own .htaccess and when it's time to update we have to modify the new .htaccess to have the redirection to https and this is just annoying.
Thank you. |
|
Back to top |
|
JorgeCarousel
Joined: 14 Jul 2022 Posts: 15 Location: USA, New york
|
Posted: Thu 14 Jul '22 21:21 Post subject: |
|
|
This is not a Enable/Disable setting, but at least it doesn't involve editing the .htaccess file
I found that adding this line to the vhosts configuration file does it:
For vhost secure.example.com add this line to its vhost configuration:
Redirect permanent / https://secure.example.com/
I hope this helps somebody else. |
|
Back to top |
|
Otomatic
Joined: 01 Sep 2011 Posts: 212 Location: Paris, France, EU
|
Posted: Fri 15 Jul '22 11:56 Post subject: |
|
|
Hi,
I prefer to put the following three lines in the VirtualHost definition because there is no need to know what the ServerName is.
Code: | RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
This can only be done if the ssl_module is loaded:
Code: | <IfModule ssl_module>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
|
|
|
Back to top |
|
|
|
|
|
|