Welcome to WebmasterWorld Guest from 54.166.179.165

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)

New User

5+ Year Member

joined:Aug 13, 2009
posts: 11
votes: 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
1:14 am on Jan 26, 2010 (gmt 0)

Senior Member

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

joined:July 3, 2002
posts:18903
votes: 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.

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

New User

5+ Year Member

joined:Aug 13, 2009
posts:11
votes: 0


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

New User

5+ Year Member

joined:Aug 13, 2009
posts:11
votes: 0


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

Senior Member

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

joined:Mar 31, 2002
posts:25430
votes: 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
6:34 pm on Feb 2, 2010 (gmt 0)

New User

5+ Year Member

joined:Aug 13, 2009
posts:11
votes: 0


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

Junior Member

5+ Year Member

joined:Aug 25, 2008
posts:88
votes: 0


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

New User

5+ Year Member

joined:Aug 13, 2009
posts:11
votes: 0


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)

Senior Member

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

joined:Mar 31, 2002
posts:25430
votes: 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