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

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

Apache Web Server Forum

Redirect double forward slash

 9:20 pm on Feb 10, 2011 (gmt 0)

I have tried all sorts of rewrite rules in htaccess but nothing I use works.

I need to redirect






 9:31 pm on Feb 10, 2011 (gmt 0)

What code have you tried so far?

There's some previous threads with example code:


 9:34 pm on Feb 10, 2011 (gmt 0)

I have tried all sorts of rewrite rules in htaccess but nothing I use works

There's multiple old thread on this topic in both this forum and Search Engine Spider Forum.

Generally speaking though, I found these double slashes were almost always caused by active links in my own pages that I'd missed correcting. The numbers will continue to propagate until your repair your syntax errors on your own pages.
There are many html tools that will do these kinds of editing in seconds as opposed to making the corrections manually.


 9:39 pm on Feb 10, 2011 (gmt 0)

There is nothing pointing to the bad url on my site. Maybe an external site is linking to it. I only picked up on it because Google has indexed it.

I have searched this forum and found various suggestions. Too many to list. None of them worked.


 9:48 pm on Feb 10, 2011 (gmt 0)

Without knowing what you have already tried and in exactly what way it "didn't work" there's no way to suggest any fixes.


 7:04 pm on Feb 11, 2011 (gmt 0)

I have tried these to remove the double slashes.

# Externally redirect to remove multiple contiguous slashes at beginning or end of URL
RewriteCond %{REQUEST_URI} ^//+(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*/)/+$
RewriteRule / http://www.example.com/%1 [R=301,L]

# Externally redirect to remove multiple contiguous slashes embedded in URL
RewriteCond %{REQUEST_URI} ^/([^/]+)//+(.*)$
RewriteRule // http://www.example.com/%1/%2 [R=301,L]

This had no effect.


 8:04 pm on Feb 11, 2011 (gmt 0)

Was that code placed in http.conf or in .htaccess?

What exactly do you mean by "no effect"?


 4:28 pm on Feb 12, 2011 (gmt 0)

surely "no effect" means when he accessed the page with a double slash, it wasn't redirected.


 6:54 pm on Feb 12, 2011 (gmt 0)

Your relatively new here and perhaps you don't understand what g1smd was asking?

Of course he understands the redirect failed, however what he requesting is specific details (not previously provided) on how the redirect failed and how it failed as to what was intended to take place.
One example is what were the results of the failed redirect in the error logs.

from the forum charter [webmasterworld.com]:
Please describe your server environment and include whatever research and testing you've done so far. This will help the members who are willing to help you, and increase their number, too. Better, more-detailed questions get faster, better, and more-detailed answers, since the other members won't have to ask you for more information.
end of quote

In addition there are numerous examples (specific questions that require answers) provided by jdmorgan on far too many occassions which provide step-by-step interpretation of "no effect".


 10:55 pm on Feb 12, 2011 (gmt 0)


What HTTP status code was returned for the request?
What content or error message was seen?
What is in the server error log, if anything?

Otherwise, the only answer to give to "no effect" is, "it's broken".


 9:50 pm on Feb 17, 2011 (gmt 0)

The code is correct, so something else is wrong -- possibly mod_rewrite is not set up and/or enabled on this server. So I have to add another question:

Do you have any currently-working mod_rewrite rules in this file?


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