Forum Moderators: phranque

Message Too Old, No Replies

space in url - redirect problem

         

newbies

12:29 am on Sep 5, 2006 (gmt 0)

10+ Year Member



Hi,

I have an inbound link from another site. There is a extra space in the link making the link invalid. The link is like:
[mydomain.com...] dir/ (note the space in front of "dir")

I tried in vain different ways of redirecting the link to the right one. None of the following works:

Redirect 301 / dir [mydomain.com...]
Redirect 301 /%20dir [mydomain.com...]
Redirect 301 /\sdir [mydomain.com...]

The first one gives a 500 error to request of any page on the site.

Your help is appreciated.

Quadrille

3:28 am on Sep 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's no good fixing your site - the problem is at the other site.

So far as your site is concerned, it's a 404, so be sure you have a user-friendly and useful page there.

Caterham

7:18 pm on Sep 5, 2006 (gmt 0)

10+ Year Member



You will match against an unescaped URL-path.

Try

Redirect 301 "/ dir" "http://mydomain.com/dir"

or

Redirect 301 /\ dir http://mydomain.com/dir 

But I don't think that the latter on woll work.

[edited by: Caterham at 7:19 pm (utc) on Sep. 5, 2006]

jdMorgan

12:57 am on Sep 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A third way to do it would be:

RedirectMatch 301 ^/\ dir(.*)$ http://example.com/dir/$1

Jim

[edited by: jdMorgan at 12:58 am (utc) on Sep. 6, 2006]

newbies

3:53 am on Sep 6, 2006 (gmt 0)

10+ Year Member



Thank you all for the suggestion. I just tried this one by Caterham
Redirect 301 "/ dir" "http://mydomain.com/dir"

It works!

Others may also work though I have not tried them.