1

I'm deploying a PHP website using lighttpd. To get nice URLs working, I've put this into the configuration file:

url.rewrite = (
    "^/(?!(wp-admin|wp-includes|wp-content))/(.*)" => "/index.php?$1",
)

This works well except of the following side effect.

  • When I call a path where the regex in url.rewrite does not match and call $_SERVER['HTTPS'], it will return "on".
  • When I call a path where the regex matches and call $_SERVER['HTTPS'], it will return nothing.

How can I tell PHP that the connection is secure when using url.rewrite ?

1 Answers1

1

This solution is a bit inflexible, but it should be fine if you are sure that the connection uses SSL:

server.modules += ( "mod_setenv" )
...
setenv.add-environment = (
    "HTTPS" => "on" 
)