0

I want to force Apache to redirect all traffic through HTTPS:

# Redirect HTTP traffic to HTTPS.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://mypublicip/$1 [R=301,L]

Unfortunately, this does not work when I am trying to access my website from my local network using my Web server's private IP. How could I work around this limitation?

isekaijin
  • 153
  • 1
  • 1
  • 6

1 Answers1

2

mod_rewrite supports more variables like %{HTTPS}. For your requirement %{HTTP_HOST} is the way to go.

joschi
  • 21,387
  • 3
  • 47
  • 50