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.

Harikrishnan
  • 1,419

2 Answers2

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.

Michael Hampton
  • 252,907
-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/
gWaldo
  • 12,027
Skaperen
  • 1,124