1

I'm trying to force SSL and non-SSL on certain pages of my site with redirects in the Lighttpd config file. I have redirects to SSL working fine:

$HTTP["host"] == "www.site.com:80" {
     url.redirect = ( "(login|register/payment|resetpassword|account/password)" => "https://www.site.com/$1" )
}

And now I'm trying to go the other way around but I can't get the pattern to hit right (had a copy working fine under apache with .htaccess):

$HTTP["host"] == "www.site.com:443" {
     url.redirect = ( "!(login|register/payment|resetpassword|account/password|images|css|javascript|minify/minify.php|states)" => "http://www.site.com/$1" )
}

I've tried many combinations but I usually end up in an endless redirect loop because the second matches all URLs when on the SSL port, or it doesn't trigger at all. Any suggestions?

1 Answer 1

2

Try using (?!: instead of !( for a negative match.

 url.redirect = ( "(?!:login|register/payment|resetpassword|account/password|images|css|javascript|minify/minify.php|states)" => "http://www.site.com/$1" )

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .