Forum Moderators: phranque

Message Too Old, No Replies

one page to another - same domain

fixing a problem

         

punisa

4:22 pm on May 11, 2008 (gmt 0)

10+ Year Member



Hi,

A link to my page was posted on one site, and I'm getting a lot of hits from there. It's a message board and the link is kinda badly written:
www.mysite.com/category/news_topic /34/topic_na me.html

Notice the spaces?
So when user clicks it:
www.mysite.com/category/news_topic%20/34/topic_na%20me.html

Can I make a redirect in htaccess so when this partcular page is requested it goes to a correct url?

I tries but when I add %20 id doesnt work, when I add url with spaces I get 500 error.

I tried this:
Redirect 301 /category/news_topic%20/34/topic_na%20me.html www.mysite.com/category/news_topic/34/topic_name.html

what seems to be the problem?
thanks

g1smd

7:41 pm on May 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Put a backslash before the space to signify that it is a literal space, and use RewriteCond rather than Redirect.

You can even set up a general rule, using a RewriteCond and regex pattern, to remove all the spaces from any URL.

punisa

6:10 pm on May 12, 2008 (gmt 0)

10+ Year Member



thanks for the tip, could you post example of RewriteCond for removing spaces?