How ever in practice we often have to remove or redirect a request url to some sub-url of that request url. To solve this we can just make some changes in the nginx configs to perform this task. Here is an example of this one:
Use alias to redirect to different url:
To send request to different url you can use alias in the nginx config. Suppose we are requesting the url /hello/users/ but we wan that the request will got to /users/ then you have to create a location and do like this:
location /hello/users/ {
alias /users/;
}Use rewrite :
You can also use rewrite also but I suggest not to do, because rewite will give the status code 301 (move permanently).
Thanks for reading this article.