'I can't redirect my domain to a subdomain using nginx location
I've a problem I tried to fix but I need help. I'm going to try to explain you what I need to do:
I have a nginx web server and I need to add a location to redirect my main page example.com to web.example.com but just this page. For anothers pages I need to use example.com/path.
For example any request to example.com it needs to redirecto to web.example.com (I can do that).
My problem start when I have a request to example.com/path and my location redirect to web.example.com/path that is not what I need.
I tried with some regular expresion but it does't work, any ideas?
Thank you!
Solution 1:[1]
If you only need a redirect for the main page try exact match location
location = / {
return 302 https://...$args;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Grin |
