Reputation: 23
I need to setup redirect rules for specific urls - I'm using NGINX.
Basically Something like this:
http://example.com/ --> http://example.com/maps
I' am trying:
location / {
proxy_pass http://maps-testmk;
include /etc/nginx/proxy_params;
return 301 http://maps-testmk.mgr.ru/maps;
}
}
but I have - 500 err
Upvotes: 2
Views: 43
Reputation: 11
May be like this:
location = / {
return 301 http://maps-testmk.mgr.ru/maps;
}
location / {
proxy_pass http://maps-testmk;
include /etc/nginx/proxy_params;
}
Upvotes: 1
Reputation: 49812
You can identify specific URLs by using the location =
syntax. For example:
location = / {
return 301 /maps;
}
location / {
proxy_pass http://maps-testmk;
include /etc/nginx/proxy_params;
}
Only the URI /
is redirected to /maps
. All other URIs (including /maps
) is sent upstream.
See this document for details.
Upvotes: 0