homepage Welcome to WebmasterWorld Guest from 54.167.138.53
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 a url with space
redirect a url linking to us with a space
pavolyeh

5+ Year Member



 
Msg#: 4067721 posted 12:09 am on Jan 26, 2010 (gmt 0)

hello all
we have one linking to us with a space at the end (www.example.com%20/)
how can I redirect it to our homepage?
Thanks

 

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4067721 posted 1:14 am on Jan 26, 2010 (gmt 0)

Do you want to redirect only this URL with a space, or any URL with a space?

The code is a trivial one-line RewriteRule with [R=301,L] flags.

pavolyeh

5+ Year Member



 
Msg#: 4067721 posted 9:10 pm on Jan 27, 2010 (gmt 0)

can you please explain a bit more how to do that
thanks

pavolyeh

5+ Year Member



 
Msg#: 4067721 posted 9:16 pm on Jan 27, 2010 (gmt 0)

wouldn't it be something like this RewriteRule ^\ $ http://www.example.com/[R=301,L]
?

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4067721 posted 12:48 am on Jan 28, 2010 (gmt 0)

More like:

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

If that doesn't work, or if you want to remove *any and all* percent-encoded trailing characters, then something like:

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^%?\ ]*)\%[^?\ ]*(\?[^\ ]*)?\ HTTP/
RewriteRule ^ http://www.example.com/%1%3 [R=301,L]

Jim

pavolyeh

5+ Year Member



 
Msg#: 4067721 posted 6:34 pm on Feb 2, 2010 (gmt 0)

Thanks Jim
sorry but didn't work, any other ways to do it?
Thanks

acimag

5+ Year Member



 
Msg#: 4067721 posted 9:42 pm on Feb 2, 2010 (gmt 0)

try RewriteRule ^test%20test%20test.html [domain.com...] [R=301]

pavolyeh

5+ Year Member



 
Msg#: 4067721 posted 11:53 pm on Feb 2, 2010 (gmt 0)

in my situation the spaces are at the end of the url
www.example.com%20/

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4067721 posted 12:24 am on Feb 3, 2010 (gmt 0)

A link with that error is unlikely to resolve to your server at all, since the top-level domain is invalid.

If it doesn't resolve to you server, then nothing you do on your server will have any effect.

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