3

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

1 Answer 1

1

Use rewrite:

rewrite ^/(.*) /?img=$1 last;
Sign up to request clarification or add additional context in comments.

7 Comments

Thanks @SuddenHead i will try this ;)
Hey i did that part that you put above that works great but i was wondering if there was a way to have it redirect to the page with the html which has it's own of displaying the image?
so you have index.html which contains <img src="foo.png"> ?
I will try this @SuddenHead
when i add that to my server block and reload nginx and access an image link i get a 500 Internal Server Error do you know what might be causing it?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.