Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the image in the URL (my server): http://www.example.com/example.jpg

If my user put this image URL on his site: return the image (normal).

If my user put this image URL on his browser: return redirect to my site, i.e. http://www.example.com/?fimage=example.jpg

How to do it?

share|improve this question

migrated from stackoverflow.com Oct 24 '11 at 18:52

This question came from our site for professional and enthusiast programmers.

Hello Caio Tarifa,

The following solutions works on my nginx dev server on Windows.

In nginx.conf, add the following to your main server instance.

location ~ \.jpg$ {
    root   html; // edit if you use a different path to your server root.
    index  index.html index.htm; // edit if you use other file types
}

If this solution doesn’t work for your configuration, take a look at the following sites:

NginX Http Rewrite Module

NginX.Conf - Full Example.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.