On Fri, 7 Dec 2007 22:38:33 -0500 "Joshua Slive" <joshua@xxxxxxxx> wrote: > 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] Thanks for that. I'm sorry to still bother. I'd like to get rid of paths like //foo/bar, too, which do not match with this rule. To be honest I don't quite understand the rule. That's probably the reason why I can't modify if correctly to match to //foo/bar as well. When I saw the regexp, I thought that I would end up without any slashes but obviously I'm not. Wouldn't matching /foo//bar/ match as $1=/foo and $2=bar/ ? Why does it not match like that? Then also it seems to me that (.*) should also match an empty string which would mean that leading slashes would get stripped, too. Why does that not happen? I'm really sorry. I'm usually not too bad with regexps (at least on Perl) but this one is confusing me. :( Cheers, Christian --------------------------------------------------------------------- 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