0

on .httaccess, we use like this.

RedirectMatch 301 ^/food/(.*)$ http//:domain.com/food-for-healthy/$1

It works good. but we have a problem with 1 old link. we used to have a multi-site and the name is "food". it changed to "food-for-healthy"

Therefore we have changed like these.

RedirectMatch 301 ^/food/(.*)$ http//:domain.com/food-for-healthy/$1

and as you know,

http//:domain.com/food/

and

http//:domain.com/food

are same.

The problem is http//:domain.com/food which needs to go to http//:domain.com/food-for-healty/

I have tried several things but it gets redirect error.

RedirectMatch 301 /food http//:domain.com/food-for-healthy

this gets a redirect error. how can I change it to work properly?

2
  • I have put "http:" instead of "http://" I don't have enough reputation to put links. :)
    – pulla
    Commented Jun 26, 2013 at 0:52
  • 1
    while you happen to be using WordPress, this is an .htaccess question and would be more appropriate on stackoverflow
    – Milo
    Commented Jun 26, 2013 at 1:03

1 Answer 1

0

You may try this...

RedirectMatch 301 ^/food$ http//:domain.com/food-for-healthy/

As per the syntax for RedirectMatch, the URL part can not be a regex. So, to achieve that you may use RewriteRule.

2
  • it comes with a redirect error and goes to http://:domain.com/food-for-healthy/food-for-healthy/food-for-healthy/food-for-healthy/food-for-healthy/food-for-healthy/food-for-healthy/food-for-healthy/...
    – pulla
    Commented Jun 26, 2013 at 5:54
  • You are right. It was my mistake. I updated my answer now. I hope that helps. Commented Jun 26, 2013 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.