Welcome to WebmasterWorld Guest from 54.158.228.55

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

redirect a url with space

redirect a url linking to us with a space

     
12:09 am on Jan 26, 2010 (gmt 0)

5+ Year Member



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
1:14 am on Jan 26, 2010 (gmt 0)

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



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.

9:10 pm on Jan 27, 2010 (gmt 0)

5+ Year Member



can you please explain a bit more how to do that
thanks
9:16 pm on Jan 27, 2010 (gmt 0)

5+ Year Member



wouldn't it be something like this RewriteRule ^\ $ http://www.example.com/[R=301,L]
?
12:48 am on Jan 28, 2010 (gmt 0)

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



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
6:34 pm on Feb 2, 2010 (gmt 0)

5+ Year Member



Thanks Jim
sorry but didn't work, any other ways to do it?
Thanks
9:42 pm on Feb 2, 2010 (gmt 0)

5+ Year Member



try RewriteRule ^test%20test%20test.html [domain.com...] [R=301]
11:53 pm on Feb 2, 2010 (gmt 0)

5+ Year Member



in my situation the spaces are at the end of the url
www.example.com%20/
12:24 am on Feb 3, 2010 (gmt 0)

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



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
 

Featured Threads

Hot Threads This Week

Hot Threads This Month