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,159
  • 2
  • 14
  • 32

2 Answers2

37
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
  • 244,070
  • 43
  • 506
  • 972
-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
  • 11,957
  • 8
  • 42
  • 69
Skaperen
  • 1,094
  • 2
  • 11
  • 23