Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

rewrite help requested



4:51 am on Apr 7, 2011 (gmt 0)

10+ Year Member

Hi all, I'm hoping someone could help me with a few rewrite rules. I'm finding some incorrect external links which are written like this

1. [sitename.com...]


2. [sitename.com...] /

3. And then sometimes there is just an extra
/ / in a url (is there a way to take all instances of a url that has / / in it to strip out the extra / ?

Could anyone please give me a specific rewrite rule that I can try that could fix all of these scenarios and do a 301 redirect?

I'm not good at all at doing rewrites so if anyone could help with some specific code I'd appreciate the assistance.

Thanks very much


10:01 am on Apr 7, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

For the double slash problem (//) i think this might help (301 redirect to normal url)

RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]


7:30 pm on Apr 7, 2011 (gmt 0)

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

Never use multiple (.*) patterns in a rule.
The rule will have to try tens of thousands of trial matches. It is very very inefficient.

Please post the code using "example.com". The forum will not auto-link "example.com" URLs.


5:25 am on May 5, 2011 (gmt 0)

10+ Year Member

I missed this response, but am still looking for a way if possible to strip out all instances of %20 in a url regardless of where they appear if that's possible.

For example:

1. http://www.example.com/dir/product-name/%20/

I would like to take out the %20 in the url

2. http://www.example.com/dir/dir/name/%20/name-page-2

need to remove the %20 in that url as well

Is there a way to always strip out the %20 in a url regardless of where it is located?

Thanks very much for the help.

Featured Threads

Hot Threads This Week

Hot Threads This Month