logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in  RSS Apache Lounge  


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.


Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Is there a setting or module for always use SSL protocol?
Author
JorgeCarousel



Joined: 14 Jul 2022
Posts: 4
Location: USA, New york

PostPosted: Thu 14 Jul '22 16:14    Post subject: Is there a setting or module for always use SSL protocol? Reply with quote

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: 4
Location: USA, New york

PostPosted: Thu 14 Jul '22 21:21    Post subject: Reply with quote

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: 86
Location: Paris, France, EU

PostPosted: Fri 15 Jul '22 11:56    Post subject: Reply with quote

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


Reply to topic   Topic: Is there a setting or module for always use SSL protocol? View previous topic :: View next topic
Post new topic   Forum Index -> Apache