Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx / php query string

Tags:

php

nginx

So i have a url like this to display images on some html this is how it works right now

subdomain.example.com/?img=foo.png

I was wondering if it was possible to hide the ?img= part of the url so the url would look something like this

subdomain.example.com/foo.png

And still make the page show the html and css i have in my code

like image 860
Custome Avatar asked May 16 '26 22:05

Custome


1 Answers

Use rewrite:

rewrite ^/(.*) /?img=$1 last;
like image 131
SuddenHead Avatar answered May 19 '26 13:05

SuddenHead



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!