2

I would like to redirect a specific section of a website from HTTP:// to HTTPS:// using Lighttpd.

I've been looking at this Lighttpd wiki entry, but the examples don't work the way I want.

I have two requirements:

  1. No specific domain should be specified in the URL redirection configuration.
    • NOT something like this: "^/(.*)" => "https://www.example.com/secure/"
  2. The redirection should also be applied to sub-items of the location, i.e.
    • http:// hostname/secure => https:// hostname/secure
    • http:// hostname/secure/subdir/file.ext => https:// hostname/secure/file.ext
    • ...
johndir
  • 305
  • 1
  • 5
  • 9

1 Answers1

3

Actually, one of their examples is a near-perfect match to your requirements - just needs tweaked to only work in the secure directory:

$HTTP["url"] =~ "^/secure/" {
  $HTTP["host"] =~ "(.*)" {
    url.redirect = ( "^/(.*)" => "https://%1/$1" )
  }
}
Shane Madden
  • 114,520
  • 13
  • 181
  • 251