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

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

 



On 2/12/06, Fabian Keil <freebsd-listen@xxxxxxxxxxxxx> wrote:
> 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.

That multiple slashes are treated as one is a feature of the
underlying filesystem. Apache gets a requests for /foo//bar, applies
the necessary translations to it, and asks the underlying OS for
<webroot>/foo//bar. It gets a document back, so all is OK from
Apache's viewpoint.

You can confirm this by doing an ls /foo/bar and ls /foo//bar wich
will give you the same output.

If you want double slashes in URLs to generate a redirect you are
probably better of using a Rewrite

For example:

RewriteRule     (^.*)/{2,}(.*$)         $1/$2 [R,L]

(disclaimer: This is of the top of my head, didn't actually test this...)

Krist


--
krist.vanbesien@xxxxxxxxx
Solothurn, Switzerland

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[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