I'm very new to nginx and just working with the rewrite rule
I want my domain http://example.com/database/view.php?id=1
to show as http://example.com/database/id/
with the GET parameter showing in the url where "id" is, is that possible?
I have attempted this :
rewrite ^/database/$arg_id? /database/view.php?id=[1-9]* last;
and
location @database {
rewrite ^/view/(.*) /view.php?id=$1&$args last;
}
and they failed resulting in example.com/database/view/51 as a 404
Fixed it :)
Solved with
rewrite ^/view/(.*)/ /database/view.php?id=$1&$args last;
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