homepage Welcome to WebmasterWorld Guest from 54.234.128.25
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

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

Apache Web Server Forum

    
redirecting URLs with %20 in string
nmjudy




msg:4247308
 5:10 am on Dec 30, 2010 (gmt 0)

I have numerous pages showing up in Google Webmaster tools that are not found. These are links from other sites linking to my site. The links are broken because of an extra space added to the URL (%20 characters).

Is there a way to redirect a link from
http://www.example.com%20
to
http://www.example.com

Thanks

 

Brett_Tabke




msg:4247568
 6:07 pm on Dec 30, 2010 (gmt 0)

Ya, you can quote the filename/directory name in an htaccess redirect rule.

jdMorgan




msg:4249448
 5:35 pm on Jan 5, 2011 (gmt 0)

Assuming that you already have other RewriteRules set up and working in example.com/.htaccess:

RewriteRule ^(.*)\ +$ http://www.example.com/$1 [R=301,L]

Place this new rule before your domain canonicalization redirect (if you have one) and before all internal rewrites. You should modify any and all more-specific URL redirects (which should precede this new rule) to allow for the optional presence of this trailing space as well.

Jim

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