Home > database >  How does nginx extract the ip from the url and then redirect to that ip?
How does nginx extract the ip from the url and then redirect to that ip?

Time:12-13

for example:

http://www.example.com/127.0.0.1/abc/1

redirect to

http://127.0.0.1/abc/1

ip 127.0.0.1 is dynamically variable

how do I write nginx configuration file

CodePudding user response:

Using RegEx, patterns can be grouped in parentheses and referenced with numbers

rewrite /([^/] )(.*) http://$1$2 permanent;
  • Related