Re: some questions to mod_rewrite

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

 



----- On Dec 11, 2020, at 4:13 PM, Eric Covener covener@xxxxxxxxx wrote:

> 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)
> 

Hi,

some more questions:

1. What is if a rule matched and a substitution occured ? When there are following rules, they are compared with the substitution, right ?
2. What is if a rule matched and a substitution occured ? Does Apache continues with the next rule or does it start from scratch with the first rule again ?
3. Let's assume we have a vhost with a conf file, and in the documentroot of the vhost a .htaccess file. In both files are RewriteRules.
  In which order are they processed ?


Bernd
Helmholtz Zentrum München

Helmholtz Zentrum Muenchen
Deutsches Forschungszentrum fuer Gesundheit und Umwelt (GmbH)
Ingolstaedter Landstr. 1
85764 Neuherberg
www.helmholtz-muenchen.de
Aufsichtsratsvorsitzende: MinDir.in Prof. Dr. Veronika von Messling
Geschaeftsfuehrung: Prof. Dr. med. Dr. h.c. Matthias Tschoep, Kerstin Guenther
Registergericht: Amtsgericht Muenchen HRB 6466
USt-IdNr: DE 129521671


---------------------------------------------------------------------
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