httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabian Keil <freebsd-lis...@fabiankeil.de>
Subject [users@httpd] Redirecting /foo//bar to /foo/bar without creating a loop
Date Sun, 12 Feb 2006 16:05:28 GMT
I would like to redirect /foo//bar (and /foo///bar etc.)
to /foo/bar. So far I failed and I'm not sure if I did something
wrong or if it's impossible with the Redirect directive.

At the moment my Apache server answers /foo//bar with 200 and sends
the document /foo/bar without letting the user know that the url was
wrong. If there is an easy way to disable this "feature" I'd like
to hear about it as well.

I can just control .htaccess and if I'm not mistaken Redirect
is the only way I can redirect with Apache 1.2, no mod_rewrite or
mod_alias for me.

My test line is:
RedirectPermanent /tmp/test// http://www.fabiankeil.de/tmp/test/

It redirects /tmp/test// as suspected: 

fk@TP51 ~ $lynx -head -dump http://www.fabiankeil.de/tmp/test//nikita-vorne.jpg
HTTP/1.1 301 Moved Permanently
Date: Sun, 12 Feb 2006 15:07:59 GMT
Server: Apache/df-exts 1.2 (Unix) mod_ssl/2.8.22 OpenSSL/0.9.7d AuthPG/1.3
Location: http://www.fabiankeil.de/tmp/test/nikita-vorne.jpg
Connection: close
Content-Type: text/html; charset=iso-8859-1

And to my surprise it even redirects /tmp/test/////////// to
/tmp/test/:

fk@TP51 ~ $lynx -head -dump http://www.fabiankeil.de/tmp/test///////////nikita-vorne.jpg
HTTP/1.1 301 Moved Permanently
Date: Sun, 12 Feb 2006 15:08:05 GMT
Server: Apache/df-exts 1.2 (Unix) mod_ssl/2.8.22 OpenSSL/0.9.7d AuthPG/1.3
Location: http://www.fabiankeil.de/tmp/test/nikita-vorne.jpg
Connection: close
Content-Type: text/html; charset=iso-8859-1

But it generates a loop:

fk@TP51 ~ $lynx -head -dump http://www.fabiankeil.de/tmp/test/nikita-vorne.jpg
HTTP/1.1 301 Moved Permanently
Date: Sun, 12 Feb 2006 15:08:23 GMT
Server: Apache/df-exts 1.2 (Unix) mod_ssl/2.8.22 OpenSSL/0.9.7d AuthPG/1.3
Location: http://www.fabiankeil.de/tmp/test/nikita-vorne.jpg
Connection: close
Content-Type: text/html; charset=iso-8859-1

I don't understand why /tmp/test// matches /tmp/test/.

Fabian
-- 
http://www.fabiankeil.de/

Mime
View raw message