Re: Redirecting paths with extra slashes

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

 



On Dec 7, 2007 8:18 PM, Christian Lerrahn <lists@xxxxxxxxxxxx> wrote:
> Hi,
> I have a site that for some reason got indexed by Google with wrong
> paths which contain too many slashes. E.g. instead of an entry for
>
> /foo/bar
>
> there might be one for
>
> /foo///bar
>
> Now this is no problem for a Apache but it is for some of my pages
> because they use relative paths. If I have an image
> in /foor/bar/index.html which looks like
>
> <img src=../../img/img1.jpg>
>
> that will work fine for /foo/bar but not for /foo///bar which will then
> look for /foo/img instead of /img.
>
> What I would like to do is get Apache to redirect wrong addresses like
> this to the correct one. That way I get the relative paths correct and
> hopefully one day Google will have it right, too. I was thinking of
> mod_rewrite but I couldn't get it to work. However, I only can get
> rules that either don't seem to do anything or ones that get me into an
> infinite loop of redirects. Can anybody give me a hint?

RewriteEngine On
RewriteRule (.*)//+(.*) $1$2 [R=permanent,L]

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