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?

  • I have put "http:" instead of "http://" I don't have enough reputation to put links. :) – pulla Jun 26 '13 at 0:52
  • 1
    while you happen to be using WordPress, this is an .htaccess question and would be more appropriate on stackoverflow – Milo Jun 26 '13 at 1:03
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.

  • 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 Jun 26 '13 at 5:54
  • You are right. It was my mistake. I updated my answer now. I hope that helps. – Pothi Kalimuthu Jun 26 '13 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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