I am trying to do a redirect using location regex.I want everything to be redirected to 404 exept from the examplesite.com with every possible path and subdomain.examplesite.com should be redirected to my server.
examplesite.com redirect
https://m.examplesite.com redirect
www.examplesite.com/something redirect
everything else redirect to 404
This is my config:
location ~ ^(?!(.?)examplesite.com/?(.*)) {
return 404;
}
location / {
return 302 $scheme://192.168.1.1/index.html; #this is a local web server
}
which must be wrong because it redirects every examplesite.com i tried to 404.
examplesite.com redirect
https://m.examplesite.com redirect
www.examplesite.com/something redirect
everything else redirect to 404
This is my config:
location ~ ^(?!(.?)examplesite.com/?(.*)) {
return 404;
}
location / {
return 302 $scheme://192.168.1.1/index.html; #this is a local web server
}
which must be wrong because it redirects every examplesite.com i tried to 404.