Welcome! Log In Create A New Profile

Advanced

Re: Rewrite with regex

Francis Daly
April 12, 2021 06:20AM
On Mon, Apr 12, 2021 at 12:02:32PM +0200, Artur wrote:

Hi there,

> This seems to work :
>
> rewrite "^/((?:[a-zA-Z0-9]+(?:[-][a-zA-Z0-9])*)+)$"
> /index.php?short_name=$1 last;
>
> However, I suppose there is no way to check the size of $1 here.

So far, it looks like you want to allow either:

* 1 letter-or-number

or

* 1 letter-or-number, then 0-to-30 letter-or-number-or-hyphen, then
1 letter-or-number

and it's probably simplest to do that as two separate "rewrite" rules.

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Rewrite with regex

Artur April 12, 2021 05:32AM

Re: Rewrite with regex

Artur April 12, 2021 06:04AM

Re: Rewrite with regex

Francis Daly April 12, 2021 06:20AM

Re: Rewrite with regex

Artur April 12, 2021 08:22AM

Re: Rewrite with regex

Francis Daly April 12, 2021 08:48AM

Re: Rewrite with regex

Artur April 12, 2021 09:02AM

Re: Rewrite with regex

Francis Daly April 12, 2021 05:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 294
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready