Wednesday, December 22, 2021

Re: Problem with rewrite in httpd [SOLVED]

On Thursday, December 23rd, 2021 at 5:10 AM, <iio7@protonmail.com> wrote:

> This works for both https://example.com/foo and https://example.com/foo/
>
> location match "^/foo/?$" {
> request rewrite "/about.php"
> }
>
> This doesn't work at all:
>
> location match "^/foo-bar/?$" {
> request rewrite "/about.php"
> }
>
> Seems like the "-" sign makes it break. What am I missing?

Sorry, I missed the fact that httpd is using Lua for regex.

There is a good amount of information on "Programming in Lua": https://www.lua.org/pil/20.2.html

I was missing the "%" escape character. This works:
location match "^/foo%-bar/?$" {
request rewrite "/about.php"
}

No comments:

Post a Comment