|
|
|
|
||||||
| comp.info.servers.unix Web servers for UNIX platforms. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
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 |
|
![]() |
| Outils de la discussion | |
|
|