Forum Moderators: phranque

Message Too Old, No Replies

redirect not working, tried escaping special characters

it's just not working!

         

gilahacker

4:41 pm on Sep 9, 2005 (gmt 0)

10+ Year Member



here it is:

redirect 301 /bookmarks/list/onecat/-Root%20Category-/*/ h_ttp://www.mydomain.com/bookmarks/list/onecat/Franchise_and_Business_Opportunity_Directory/

(I changed http to h_ttp for this post so it wouldn't hyperlink it)

I tried escaping the * and % with a "\" but it made no difference...

I've got about a hundred other redirects that work fine, I don't know why this one won't. I just "fixed" the urls a bit for my directory and want to point the old page to the new one. I don't care about the subcategories, google's going to have to re-index them all anyways. I just want it to know where to start.

google has my directory indexed as www.mydomain.com/bookmarks/list/onecat/-Root%20Category-/*/

Any ideas?

Thanks in advance!
-Jason

jd01

6:36 pm on Sep 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



**Disclaimer**

(I get in trouble every time I post an answer to a mod_alias question, because I never use it, so take everything I post with a grain of salt.)

**End Disclaimer**

Have you tried it with just a (space)?

I do not believe you will get very far with Redirect and escaping, because it does not support regex...

If you would like to keep using mod_alias you might have some luck with:

RedirectMatch 301 /bookmarks/list/onecat/-Root\ Category-/\*/$ h_ttp://www.mydomain.com/blah/stuff

OR

RedirectMatch 301 /bookmarks/list/onecat/-Root.Category-/\*/$ h_ttp://www.mydomain.com/blah/stuff

OR

You could always use mod_rewrite:

RewriteEngine on
RewriteRule /bookmarks/list/onecat/-Root\ Category-/\*/$ h_ttp://www.mydomain.com/blah/stuff [R=301,L]

Hope this helps.

Justin

gilahacker

8:23 pm on Sep 9, 2005 (gmt 0)

10+ Year Member



I tried it with just the space... it doesn't do anything...

tried RewriteRule /bookmarks/list/onecat/-Root\ Category-/\*/$ h_ttp://www.mydomain.com/list/onecat/Franchise_and_Business_Opportunity_Directory/*/ [R=301,L]
(with and without the "*/" at the end, no difference)

and it didn't do anything still...

RedirectMatch 301 /bookmarks/list/onecat/-Root\ Category-/\*/$ h_ttp://www.mydomain.com/bookmarks/list/onecat/Franchise_and_Business_Opportunity_Directory/*/

didn't work either, I even tried putting the %20 back in there instead of the space, and then tried escaping the "%" symbol, still nothing...

RedirectMatch 301 /bookmarks/list/onecat/-Root.Category-/\*/$ h_ttp://www.mydomain.com/bookmarks/list/onecat/Franchise_and_Business_Opportunity_Directory/*/

finally worked! I'm not really sure how "%20" turns into a "." but whatever, it worked!

THANK YOU!

-Jason

jd01

8:26 pm on Sep 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



%20 is an encoded (space) -- .(dot) is a meta character that stands for 'any character except the end of a line'

In this case, the .(dot) matches the (space) and will redirect accordingly.

Justin

jbgilbert

8:36 pm on Sep 9, 2005 (gmt 0)

10+ Year Member



I have had this exact same issue! And, it's about time I contributed to this redirect stuff!

If using rewriterule,
show tha actual "space", but escape it with "\". Like this:

URL in Google shows as:
word1%20word2.htm

in rewriterule it looks like this:
word1\ word2\.htm$
( see the actual blank and the escape in front of it?)

gilahacker

8:49 pm on Sep 9, 2005 (gmt 0)

10+ Year Member



@jbgilbert

the "\ " didn't work for me... but the "." did...