Re: some questions to mod_rewrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 11, 2020 at 10:06 AM Lentes, Bernd
<bernd.lentes@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
> ----- On Dec 9, 2020, at 6:02 PM, Eric Covener covener@xxxxxxxxx wrote:
>
> Hi Eric,
>
> thanks for your answer.
> Now i'm struggling with RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
>
> Most is clear. The content of the parentheses () like build, tests .. is or-conjuncted by the pipe |,
> so only one of the patterns must appear.
> But what is ?: ?

It makes the () "non-capturing" meaning if you had other () sequences
this or-conjunction would not eat up $1.
In the case above it is unnecessary since there is no other capture.

> The question mark normally is a repeater for the prior character. But there is no one.
> And wherefore is the colon ?

It's a special case when following "(". It allows the
matching/capturing to be customized a few different ways (man
pcresyntax has a concise list of the flags that follow "(?")

> I gave https://perldoc.perl.org/perlre#Metacharacters a chance. It seems the ?: says that a match for (build|tests|config|lib|3rdparty|templates)
> can't be used as a backreference. Right ? Where is the purpose of that ?

yes, just to avoid eating up $1. But some people do it out of habit
when they use () just to group "|".


> in my error_log with setting "LogLevel info rewrite:trace2":
> [Fri Dec 11 15:44:50.666869 2020] [rewrite:trace1] [pid 3408] mod_rewrite.c(483): [client 146.107.126.166:57329] 146.107.126.166 - -
> [nc-mcd.helmholtz-muenchen.de/sid#7f9158e4f700][rid#7f9155a2a0a0/initial] [perdir /var/www/nextcloud/] pass through /var/www/nextcloud/
>
> What is sid and rid ?

server (vhost) id and request id i believe. Usually not so useful.
The /initial meant it's not a "subrequest" (a way apache modules
sometimes make an internal request related to the real request to
probe for things)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux