[users@httpd] Redirecting /foo//bar to /foo/bar without creating a loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux