homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Issue With // Appearing in URLS

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


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,


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)


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)

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)

March 2012 [webmasterworld.com]

2009 [webmasterworld.com]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved