Project

General

Profile

[Solved] url.redirect without pcre?

Added by subash over 4 years ago

Hi,
For a config rule like for url redirection like as below, does lighttpd still need libpcre?
url.rewrite-once = (".*" => "/blah.html")
_
I understand that ".*" is regex, but is it possible to redirect without regex/pcre? As it is more like a catch-all.

Thanks,
Subash


Replies (6)

RE: url.redirect without pcre? - Added by gstrauss over 4 years ago

mod_rewrite and mod_redirect depend on PCRE.

However, there is a catchall "" which matches everything and skips PCRE (for performance). You can use

if $HTTP["url"] != "/blah.html" {
  url.rewrite.once = ( "" => "/blah.html" )
}

Similarly for mod_redirect:

url.redirect = ( "" => "http://other.domain/blah.html" )

You can use parts of the parsed URL in the substitution, including ${url.authority} ${url.path} and others. See Docs_ModRewrite Extended Replacement Patterns

RE: [Solved] url.redirect without pcre? - Added by jonny over 4 years ago

Hi,

is there a way to forward port 80 to 443 without pcre?
Maybe with rewrite?

Regards John

RE: [Solved] url.redirect without pcre? - Added by gstrauss over 4 years ago

johnny, please read the comments above your post where the answer is already provided.

RE: [Solved] url.redirect without pcre? - Added by jonny over 4 years ago

i've tried with:

added mod_redirect and

$HTTP["scheme"] == "http" { url.redirect = ("" => "https://${url.authority}${url.path}${qsa}") }

but its not working

RE: [Solved] url.redirect without pcre? - Added by gstrauss over 4 years ago

Did you try reading the documentation? Please try again.

lighttpd provides ways to substitute URI parts without needing a regex match (since 1.4.50) (and can be preceded by encoding modifier, e.g. ${tolower:url.authority})

RE: [Solved] url.redirect without pcre? - Added by alex-che 28 days ago

Seems like in 1.4.65 it's actually become possible to build lighttpd w/o PCRE support and have the "" filter working.

Before this version the mentioned short-circuit code was inside the HAVE_PCRE preprocessor block and thus was not working for lighttpd built w/o PCRE support.

    (1-6/6)