httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jos...@slive.ca>
Subject Re: [users@httpd] RedirectMatch = HideMatch
Date Thu, 05 Jun 2003 17:47:31 GMT


On Thu, 5 Jun 2003, Ken Gillett wrote:
> Well I can't really see that - computers never make sense out of
> garbage:-)

I know you're joking, but what I meant is that Apache did allow users to
send non-RFC compliant redirects in previous version.  Luckily for these
users, the browser would often make some assumptions about what was
intended and perform the redirect anyway.

> The actual line was:
>
> 	RedirectMatch ".*~(.*[^ ]) ?$" ../$1

> > The docs for Redirect/RedirectMatch are quite clear that only an
> > absolute URL is acceptable:
> > http://httpd.apache.org/docs-2.0/mod/mod_alias.html#redirect
>
> Actually, I don't think that is true

The second parameter, according to the "Syntax" is "URL".  If you consult
http://httpd.apache.org/docs-2.0/mod/directive-dict.html#Syntax
you'll see that URL means an absolute URL starting with a scheme and
hostname.

> Seems to have made sense with Apache v1. I'll have a look at some fancy
> regex'ing, but any more assistance with this problem would be much
> appreciated.

It doesn't make sense because the "Location:" HTTP response header
generated by Apache must contain an absolute URL according to the HTTP
specs (RFC 2616 sec 14.30).  You seem to think that a redirect is like an
<a href>, but it is not.  It does not have the same url resolution rules.

Now, I suppose that Apache could impliment those rules for you to send
back to browser, but I think that the results wouldn't be very pleasing in
general, because it would be very difficult to recreate the exact behavior
of the browser in response to that link.

But all is not lost.  Something approaching what you want is

RedirectMatch ^/(.*)/[^/]*/~([^/])$ http://yoursite.example.com/$1/$2

What this does is simply remove the last directory for any filename
starting in ~.  I haven't dealt with the space issue, but you can probably
work that in (although the existence of a bare space seems very unlikely).

Joshua.


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


Mime
View raw message