Welcome to WebmasterWorld Guest from 18.204.227.250

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

is a live file that same as / . danger?

When I look at my server pages that have //'s in them are the same as /

     
9:41 am on May 10, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Oct 6, 2003
posts:235
votes: 0


Hi all,

I should start off with "I am not a server techy". Although I am as paranoid as the next man about server problems and, more to the point, how to avoid them.

I have been looking recently at my logs on a newly built Linux server. There is something peculiar that I have not seen before.

I find the a page like: www.xsomething.com/directory/ is there as normal.

But, when I look at: www.xsomething.com//directory/ or www.xsomething.com//directory// the same page appears.

I have looked on other sites and they seems to have similar. Yet I have never noted any visits to these urls before.

Does anyone know if this causes problems with search engines? I am thinking along the lines of www and non www issues.

4:07 pm on May 10, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


This is a default behaviour of Apache, in that it simply ignores extra slashes.

As far as concern about duplicate content caused by this, I'd put it in the 'minor concern' class. You might want to look through some search results to see if you can find a double-slashed URL in the results listing -- I don't think I've ever seen one, but then, I don't recall ever looking.

As usual, a bit of mod_rewrite can be used to fix it if it is ever a problem:


# Remove extra slashes in URL
RewriteCond %{REQUEST_URI} ^(.*)//+(.*)$
RewriteRule . http://www.example.com%1/%2 [R=301,L]

This implementation, unlike that using only a RewriteRule without a RewriteCond, will remove leading double-slashes as in "example.com//site_map.xml".

A more complex solution is needed to fix multiple occurrences of double-slashes in one URL using only a single redirect, but this occurs so rarely that I hardly ever bother with it.

Also, the "double dot-star" type of pattern used here is notoriously inefficient processing-wise (matching such patterns can require hundreds of re-tries by the regex parser depending on requested URL length and content), so I prefer to use it only if actually needed.

Jim

6:27 pm on May 10, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Oct 6, 2003
posts:235
votes: 0


Jim,

Thanks for looking at this and your detailed reply. I will try adding your code to my servers.

If it is not a problem generally and is there by default it must just my paranoia then ^^

Maybe to many years at it O_o