You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Homsher, Dave V." <Da...@mactac.com> on 2004/03/04 14:50:50 UTC

[users@httpd] aliasmatch negated class regexp

I'm hoping someone can help here.

I am trying to do an alais match that matches on requests that do not end in
"html". 
I have tried perl syntax, POSIX 1003.2 syntax, and several of my own made up
syntaxes ;)


Here is what I have tried to no avail:

AliasMatch "[.^html.]$" "/new/location/foo.bar"		# compiles but
doesn't work
AliasMatch "[^.html.]$" "/new/location/foo.bar"		# ditto
AliasMatch "[^[.html.]]$" "/new/location/foo.bar"	# error: can't
compile regexp
AliasMatch "[^(html)]$" "/new/location/foo.bar"		# doesn't work

any ideas?

Thanks
Dave Homsher
MACtac IT

----
Those who cannot conceive a happiness of their own accept a definition
imposed upon them by others.
-- Earl Shorris 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] aliasmatch negated class regexp

Posted by Brian Dessent <br...@dessent.net>.
"Homsher, Dave V." wrote:

> I am trying to do an alais match that matches on requests that do not end in
> "html".
> I have tried perl syntax, POSIX 1003.2 syntax, and several of my own made up
> syntaxes ;)
> 
> Here is what I have tried to no avail:
> 
> AliasMatch "[.^html.]$" "/new/location/foo.bar"         # compiles but
> doesn't work
> AliasMatch "[^.html.]$" "/new/location/foo.bar"         # ditto
> AliasMatch "[^[.html.]]$" "/new/location/foo.bar"       # error: can't
> compile regexp
> AliasMatch "[^(html)]$" "/new/location/foo.bar"         # doesn't work

You're misunderstanding the use of the character class [ ] tokens.  They
specify a class, not a string.  In other words [html] means "a single
character, either h, t, m, or l".  [.^html.] means "one of the following
charactrs: h t m l . ^".

I think what you want is to use mod_rewrite instead, as it has a
built-in negation.

RewriteEngine On
RewriteRule !\.html$ /new/location/foo.bar [L]

It looks like you're trying to redirect your users to a new page from
some old broken links.  If you want the server to issue an actual
redirect then use [R,L] instead.  This will cause the browser to fetch
the new URL, and so it will change in the browser's URL bar.  Otherwise
the user will still see the old link.

Brian

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] aliasmatch negated class regexp

Posted by Luis Moreira <lu...@esinnovation.pt>.
    I am not a guru on regular expressions, so forgive all you beautiful
people out there who are, if I say something silly...

    As far as I know, AliasMatch is a directive to use when expressions
MATCH something, not the othe way around.
    If what you want is "the other way around", I suppose it's logical to do

    1) AliasMatch "to-match-html-extensions" URL1
    2) AliasMatch "to-match-everything-else" URL2

Luis

----- Original Message -----
From: "Homsher, Dave V." <Da...@mactac.com>
To: <us...@httpd.apache.org>
Sent: Thursday, March 04, 2004 1:50 PM
Subject: [users@httpd] aliasmatch negated class regexp


> I'm hoping someone can help here.
>
> I am trying to do an alais match that matches on requests that do not end
in
> "html".
> I have tried perl syntax, POSIX 1003.2 syntax, and several of my own made
up
> syntaxes ;)
>
>
> Here is what I have tried to no avail:
>
> AliasMatch "[.^html.]$" "/new/location/foo.bar" # compiles but
> doesn't work
> AliasMatch "[^.html.]$" "/new/location/foo.bar" # ditto
> AliasMatch "[^[.html.]]$" "/new/location/foo.bar" # error: can't
> compile regexp
> AliasMatch "[^(html)]$" "/new/location/foo.bar" # doesn't work
>
> any ideas?
>
> Thanks
> Dave Homsher
> MACtac IT
>
> ----
> Those who cannot conceive a happiness of their own accept a definition
> imposed upon them by others.
> -- Earl Shorris
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org