Project

General

Profile

[Solved] Redirect not redirecting

Added by theking2 about 2 months ago

With this in the lighttpd.conf file pool.ntp.org is not redirected but opens the default local server

$HTTP["host"] == "pool.ntp.org|ch.pool.ntp.org" {
    accesslog.filename = "/var/log/lighttpd/pool.ntp.org_access.log" 
    $HTTP["url"] =~ "^/$" {
        url.redirect = ( "/" => "https://ntppool.org" )
        url.redirect-code = 301
    }
}

shows the contents of /var/www/html/index.html not https://ntppool.org


Replies (3)

RE: Redirect not redirecting - Added by gstrauss about 2 months ago

$HTTP["host"] == "pool.ntp.org|ch.pool.ntp.org" {
should instead be
$HTTP["host"] =~ "pool.ntp.org|ch.pool.ntp.org" {
since it looks like you intended a regex.

For exact match of host, I would use a more precise regex
$HTTP["host"] =~ "^(?:ch\.)?pool\.ntp\.org$" {

RE: [Solved] Redirect not redirecting - Added by gstrauss about 2 months ago

You might have troubleshot this yourself using
Configuration: Debug Variables
debug.log-condition-handling = "enable"

    (1-3/3)