Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

The double slash in URL problem

http://example.com/folder//file.htm status 200

         

jetteroheller

7:44 am on Jan 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just discovered in my log files

/folder//file.htm 200

I already posted in the apache forum, but further investigations showed, that it's also a theme for this forum.

/folder//file.htm

gives the same page as

/folder/file.htm

both with status 200 OK

But naturaly,

../misc/layout.css
../misc/layout.js

lead not to the right target, so the page does not work normal, since CSS and javascript not loaded.

I tried to find out how to eliminate the problem by .htaccess

My search engine query leaded to a post in an SEO forum.

Here a text from this forum
_____________________________________________________________
A few weeks ago we only were surprised when we discovered requests in our access_log for documents in the directory 'example' folowed by a trailing double slash. Googlebot requested documents as for example: example.com / example // documentname.html.
_____________________________________________________________

It followed some drastic traffic loose from Google.

Could some nice links from competitors like

http://example.com/folder//file.htm

The "almost" nothing, what an other web site can do to Your ranking?

So now questions:

How to detect this problem
How to avoid by some .htaccess settings?

LunaC

4:20 pm on Jan 18, 2007 (gmt 0)

10+ Year Member



This is the code I got in the Apache forum a while back when I had the same problem:

# remove multiple slashes anywhere in url
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . http://www.example.com%1/%2 [R=301,L]

If you haven't already added prevention / fixes for other duplicate problems, you may want to look for these as well:

- non www to www (or the reverse depending which you prefer)
- .com/ and .com/index.html duplicates
- .com./ redirected to .com/ (notice misplaced dot in first example)
- removal of useless query strings (ie. example.com/?junk)

jdMorgan recently wrote a great guide [webmasterworld.com] for pretty much every issue that can arise, including the ones I mentioned and a many others.
It's a lot to go through and customize to your needs, but it's the most complete set of fixes I've ever seen.

AndyA

4:39 pm on Jan 18, 2007 (gmt 0)

10+ Year Member



Make sure your config file isn't set up wrong. Invisionboard is especially bad about this. It asks for your website URL, but doesn't tell you to exclude the trailing slash, as it's already hard coded into the cofig file.

If you add the trailing slash to the URL, your forum generates every URL with double slashes! My forum did this for over a year before I figured out what the problem was.