Permanent redirect (301) with lighttpd

If you want to redirect visitors that access your website without the ‘www’, you can use mod_redirect with the following syntax: $HTTP[”host”] =~ “^lescampeurs\.org” { url.redirect = ( ”^/(.*)$” => “http://www.lescampeurs.org/$1″ ) } Links: Lighttpd mod_redirect HTTP 3xx status codes

 

Use mod_redirect with lighttpd

Enable mod_redirect server.modules += ( “mod_redirect” ) Force your domain with www. $HTTP[“host”] =~ “^domain\.com$” { url.redirect = ( “^/(.*)” => “http://www.domain.com/$1” ) } Force your domain without www. $HTTP[“host”] =~ “^www\.domain\.com$” { url.redirect = ( “^/(.*)” => “http://domain.com/$1” ) } Redirect HTTP requests to HTTPS $SERVER[“socket”] == “:80” { $HTTP[“host”] =~ “(.*)” { url.redirect …