PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.info.servers.unix > regex in locationmatch
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.info.servers.unix Web servers for UNIX platforms.

regex in locationmatch

Réponse
 
LinkBack Outils de la discussion
Vieux 02/05/2006, 00h53   #1
Julian Wood
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut regex in locationmatch

I posted about this a few weeks ago and got pretty far, but now I have
an additional requirement that I haven't been able to create a regex
for. I'm using locationmatch like this:

<LocationMatch "/tlcprojectswiki/index.php/[^(Category)][^(Public)]">
...
require valid-user
</LocationMatch>

I need this regex to match as follows:

/tlcprojectswiki/index.php/Public/tester -- open
/tlcprojectswiki/index.php/Main_Page -- pswd (ie match)
/tlcprojectswiki/index.php/User:Woodj -- pswd (ie match)
/tlcprojectswiki/skins/monobook/IE55Fixes.css -- open
/tlcprojectswiki/skins/common/wikibits.js -- open
/tlcprojectswiki/images/UofC.gif -- open
/tlcprojectswiki/index.php/Category:Public -- open
/tlcprojectswiki/index.php?title=Special:Userlogin&returnto=Public/Projec
t_Versioning_-_Best_Practices -- pswd (ie match)

The provided regex matches the first two, but not the last required
match.

Any ideas how to get it to match that last one? I've tried lots of
permutations, but haven't gotten much closer.

Of course, adding another LocationMatch just for this last requirement
doesn't work. In fact, it makes the entire directory open, which makes
no sense to me at all, other than that they conflict and so Apache
ignores both directives.

Thanks in advance,

Julian
  Réponse avec citation
Vieux 02/05/2006, 09h57   #2
Robert Ionescu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: regex in locationmatch

Julian Wood wrote:
> I posted about this a few weeks ago and got pretty far, but now I have
> an additional requirement that I haven't been able to create a regex
> for. I'm using locationmatch like this:
>
> <LocationMatch "^/tlcprojectswiki/index.php/[^(Category)][^(Public)]">


with [^(Category)] you're excluding the characters ()aCegorty and not
the word Category.

You're looking for a negative lookahead like

<LocationMatch "^/tlcprojectswiki/index\.php/(?!(Category|Public))">

which works only with apache 2.x, since this is a PCRE and Apache 1.3
shipps with the POSIX Extended RegEx library.

--
Robert
  Réponse avec citation
Vieux 02/05/2006, 09h57   #3
Robert Ionescu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: regex in locationmatch

Julian Wood wrote:
> I posted about this a few weeks ago and got pretty far, but now I have
> an additional requirement that I haven't been able to create a regex
> for. I'm using locationmatch like this:
>
> <LocationMatch "^/tlcprojectswiki/index.php/[^(Category)][^(Public)]">


with [^(Category)] you're excluding the characters ()aCegorty and not
the word Category.

You're looking for a negative lookahead like

<LocationMatch "^/tlcprojectswiki/index\.php/(?!(Category|Public))">

which works only with apache 2.x, since this is a PCRE and Apache 1.3
shipps with the POSIX Extended RegEx library.

--
Robert
  Réponse avec citation
Vieux 02/05/2006, 09h57   #4
Robert Ionescu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: regex in locationmatch

Julian Wood wrote:
> I posted about this a few weeks ago and got pretty far, but now I have
> an additional requirement that I haven't been able to create a regex
> for. I'm using locationmatch like this:
>
> <LocationMatch "^/tlcprojectswiki/index.php/[^(Category)][^(Public)]">


with [^(Category)] you're excluding the characters ()aCegorty and not
the word Category.

You're looking for a negative lookahead like

<LocationMatch "^/tlcprojectswiki/index\.php/(?!(Category|Public))">

which works only with apache 2.x, since this is a PCRE and Apache 1.3
shipps with the POSIX Extended RegEx library.

--
Robert
  Réponse avec citation
Vieux 02/05/2006, 09h57   #5
Robert Ionescu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: regex in locationmatch

Julian Wood wrote:
> I posted about this a few weeks ago and got pretty far, but now I have
> an additional requirement that I haven't been able to create a regex
> for. I'm using locationmatch like this:
>
> <LocationMatch "^/tlcprojectswiki/index.php/[^(Category)][^(Public)]">


with [^(Category)] you're excluding the characters ()aCegorty and not
the word Category.

You're looking for a negative lookahead like

<LocationMatch "^/tlcprojectswiki/index\.php/(?!(Category|Public))">

which works only with apache 2.x, since this is a PCRE and Apache 1.3
shipps with the POSIX Extended RegEx library.

--
Robert
  Réponse avec citation
Vieux 02/05/2006, 17h59   #6
Julian Wood
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: regex in locationmatch

Robert Ionescu wrote:

> Julian Wood wrote:
> > I posted about this a few weeks ago and got pretty far, but now I have
> > an additional requirement that I haven't been able to create a regex
> > for. I'm using locationmatch like this:
> >
> > <LocationMatch "^/tlcprojectswiki/index.php/[^(Category)][^(Public)]">

>
> with [^(Category)] you're excluding the characters ()aCegorty and not
> the word Category.
>
> You're looking for a negative lookahead like
>
> <LocationMatch "^/tlcprojectswiki/index\.php/(?!(Category|Public))">
>
> which works only with apache 2.x, since this is a PCRE and Apache 1.3
> shipps with the POSIX Extended RegEx library.


Thanks Robert. I'm always looking for a chance to improve my dismal
regex skills.

So for Apache 1.3.x, I'm SOL trying to unprotect those particular
documents?

Thanks,

Julian
  Réponse avec citation
Vieux 02/05/2006, 17h59   #7
Julian Wood
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: regex in locationmatch

Robert Ionescu wrote:

> Julian Wood wrote:
> > I posted about this a few weeks ago and got pretty far, but now I have
> > an additional requirement that I haven't been able to create a regex
> > for. I'm using locationmatch like this:
> >
> > <LocationMatch "^/tlcprojectswiki/index.php/[^(Category)][^(Public)]">

>
> with [^(Category)] you're excluding the characters ()aCegorty and not
> the word Category.
>
> You're looking for a negative lookahead like
>
> <LocationMatch "^/tlcprojectswiki/index\.php/(?!(Category|Public))">
>
> which works only with apache 2.x, since this is a PCRE and Apache 1.3
> shipps with the POSIX Extended RegEx library.


Thanks Robert. I'm always looking for a chance to improve my dismal
regex skills.

So for Apache 1.3.x, I'm SOL trying to unprotect those particular
documents?

Thanks,

Julian
  Réponse avec citation
Vieux 02/05/2006, 17h59   #8
Julian Wood
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: regex in locationmatch

Robert Ionescu wrote:

> Julian Wood wrote:
> > I posted about this a few weeks ago and got pretty far, but now I have
> > an additional requirement that I haven't been able to create a regex
> > for. I'm using locationmatch like this:
> >
> > <LocationMatch "^/tlcprojectswiki/index.php/[^(Category)][^(Public)]">

>
> with [^(Category)] you're excluding the characters ()aCegorty and not
> the word Category.
>
> You're looking for a negative lookahead like
>
> <LocationMatch "^/tlcprojectswiki/index\.php/(?!(Category|Public))">
>
> which works only with apache 2.x, since this is a PCRE and Apache 1.3
> shipps with the POSIX Extended RegEx library.


Thanks Robert. I'm always looking for a chance to improve my dismal
regex skills.

So for Apache 1.3.x, I'm SOL trying to unprotect those particular
documents?

Thanks,

Julian
  Réponse avec citation
Vieux 04/05/2006, 00h22   #9
Robert Ionescu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: regex in locationmatch

Julian Wood wrote:
> So for Apache 1.3.x, I'm SOL trying to unprotect those particular
> documents?


You can try to use a more specific LocationMatch below
"^/tlcprojectswiki/index\.php/" using Satisfy any.

<LocationMatch "^/tlcprojectswiki/index\.php/">
require valid-user
.....
</LocationMatch>

<LocationMatch "^/tlcprojectswiki/index\.php/(Category|Public)">
Satisfy any
.....
</LocationMatch>

--
Robert
  Réponse avec citation
Vieux 04/05/2006, 00h22   #10
Robert Ionescu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: regex in locationmatch

Julian Wood wrote:
> So for Apache 1.3.x, I'm SOL trying to unprotect those particular
> documents?


You can try to use a more specific LocationMatch below
"^/tlcprojectswiki/index\.php/" using Satisfy any.

<LocationMatch "^/tlcprojectswiki/index\.php/">
require valid-user
.....
</LocationMatch>

<LocationMatch "^/tlcprojectswiki/index\.php/(Category|Public)">
Satisfy any
.....
</LocationMatch>

--
Robert
  Réponse avec citation
Vieux 04/05/2006, 00h22   #11
Robert Ionescu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: regex in locationmatch

Julian Wood wrote:
> So for Apache 1.3.x, I'm SOL trying to unprotect those particular
> documents?


You can try to use a more specific LocationMatch below
"^/tlcprojectswiki/index\.php/" using Satisfy any.

<LocationMatch "^/tlcprojectswiki/index\.php/">
require valid-user
.....
</LocationMatch>

<LocationMatch "^/tlcprojectswiki/index\.php/(Category|Public)">
Satisfy any
.....
</LocationMatch>

--
Robert
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h46.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15898 seconds with 19 queries