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

rewrite help requested

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

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)

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)

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)

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.

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