[Solved] mod_rewrite - how Extended Replacement Patterns work
Added by m35 over 5 years ago
I refer specifically to the section about "ways to substitute URI parts without needing a regex match"
I've tried several ways of using them, but the rewrite never works.
Here is one simple example.
example.conf
server.modules = ( "mod_rewrite" ) server.document-root = "." url.rewrite-once = ( "/a" => "${url.path}" ) debug.log-condition-handling = "enable" debug.log-request-header = "enable" debug.log-response-header = "enable" debug.log-request-handling = "enable" debug.log-file-not-found = "enable"
/a
Anything
Sever started with
sudo lighttpd -D -f example.conf
Navigating to localhost/a results in "404 - Not Found"
In the logs I see
2018-09-05 22:10:27: (response.c.350) -- splitting Request-URI 2018-09-05 22:10:27: (response.c.351) Request-URI : /a 2018-09-05 22:10:27: (response.c.352) URI-scheme : http 2018-09-05 22:10:27: (response.c.353) URI-authority : localhost 2018-09-05 22:10:27: (response.c.354) URI-path (raw) : /a 2018-09-05 22:10:27: (response.c.355) URI-path (clean): /a
The URI-path is "/a", so I thought "${url.path}" would also be "/a"
But the logs show it is mapped to the literal string "${url.path}".
For this simple little example, how would I use ${url.path} to map /a to /a?
Or, if this isn't how it should be used, in general, how do these similar replacements work?
Thank you for your consideration.
Ubuntu 08.04
lighttpd/1.4.45 (ssl) - a light and fast webserver
Build-Date: Feb 6 2018 12:41:51
Chrome
Version 68.0.3440.106 (Official Build) (64-bit)
Replies (1)
RE: mod_rewrite - how Extended Replacement Patterns work - Added by gstrauss over 5 years ago
Docs_ModRewrite notes that this syntax is available in lighttpd 1.4.50 and later.
Quote from the documentation: "lighttpd provides ways to encode redirect and rewrite backreference substitutions (since 1.4.50) in curly-braces %{...} or ${...}"