I am trying to find a way to extract some text from a url to be used in alias. The url is something like:
/test/user_code_name/
and the alias should be
/test1/user_name/
So the idea is to just remove the part between _ and _ and use it like a variable.
Thx L.
try these settings:
location / {
if ( $request_uri ~ ^/(.*)/(.*)_.*_(.*)/$ ) {
rewrite ^ /$1/$2_$3/ break;
}
}
Please read more about nginx rewrite module here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With