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: Redirecting http to https
Author
cearlp



Joined: 17 Sep 2022
Posts: 1
Location: Clinton

PostPosted: Sat 17 Sep '22 23:26    Post subject: Redirecting http to https Reply with quote

Using Apache 2.4.52 (Ubuntu) and have ServerName as mysite.com and ServerAlias as www.mysite.com in both VirtualHost (*:80 and *:443) descriptions in the
mysite.conf file. I inserted Redirect permanent / https://mysite.com/ in the *:80 portion and everything (https://mysite.com, www.mysite.com and mysite.com) get routed to https except when the URL is http://mysite.
Is this as designed or is there something I am missing?
Back to top
Otomatic



Joined: 01 Sep 2011
Posts: 89
Location: Paris, France, EU

PostPosted: Mon 19 Sep '22 8:51    Post subject: Reply with quote

Hi,

Instead of "Redirect permanent" I prefer to use :
Code:

  <IfModule ssl_module>
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  </IfModule>

in the VirtualHost port 80 definition.
Back to top


Reply to topic   Topic: Redirecting http to https View previous topic :: View next topic
Post new topic   Forum Index -> Apache