23

I need to redirect only http://shop.test.com to http://www.test.com/fedex-orders/

Just homepage. Nothing else. ie http://shop.test.com/?page=blog should NOT redirect.

0

2 Answers 2

38
location = / {
    return 301 http://www.test.com/fedex-orders/;
}

The use of = in location= / specifies that the URL must match / exactly, with nothing else preceding or following it.

0
-3

In case you look for an answer how to solve this in Apache; This would be what you want:

RedirectMatch permanent ^/$ http://www.test.com/fedex-orders/
3
  • getting error on configtest Mar 25, 2013 at 6:35
  • 2
    That's because this is an Apache configuration directive. Mar 25, 2013 at 11:40
  • 2
    This ISN'T the correct answer. The question is about nginx, not apache. Feb 17, 2016 at 12:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .