Welcome to WebmasterWorld Guest from 54.145.209.34

Forum Moderators: Ocean10000 & incrediBILL & phranque

Issue With // Appearing in URLS

   
3:49 am on Jul 7, 2012 (gmt 0)



Hi,

How do I remove all instances of // in the url?

This problem is giving me 100,000+++ 404 errors and duplicate content issues in Google Webmaster tools.

For example,

onlinediamondbuyingguide.com//Essential-Education//Diamond-Clarity.html

Because of the //, the entire nagivation and side bar returns rubbish links that propagate more duplicate content and 404 errors.

The Link Below shows how it works normally and is OK.

[onlinediamondbuyingguide.com ]

Navigation and everything works fine.

The funny thing is, in any wordpress blogs, any instances of // gets removed automatically. How did they do that?

how can I code the htaaccess to remove instances of // and replacing it with / whenever it encounters them?

Anyone can help on this?
4:57 am on Jul 7, 2012 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Eeuw.

Double slashes are not the #1 single most common question posted here. But they come up often enough that you can search and find plenty of earlier threads. Do not try "//" as a search string; use "double slash".

This is assuming you are talking about legitimate human (or welcome robotic) visitors looking for real pages. The double or multiple slash inserted by unwated robots is a whole nother issue. But a Forums search will bring up both of them.

Make sure you deal with both parts of the problem: how to redirect appropriately, and how to trace the problem to its source.

Incidentally, a // at the very beginning of the URL-- right after the domain name-- may not even malfunction. Possibly it depends on your server. I've seen the occasional specimen in logs, complete with successful image requests. It's the // deeper into the URL that is really troublesome.
6:17 am on Jul 7, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Rewrite (that's rewrite not redirect) any request with double or more slashes to a special PHP script that then detects the requested URL, uses preg_replace to fix it, and then sends a 301 header redirecting to the correct URL.

That's your short term fix.

The long term fix has to be to fix the bug in the site script that allowed the error to propagate.
11:52 am on Jul 7, 2012 (gmt 0)

WebmasterWorld Senior Member wilderness is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month




March 2012 [webmasterworld.com]


2009 [webmasterworld.com]
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month