Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

my file on image folder ( has been accessed by some websites using how to redirect to via nginx?

Thank in advanced

Found it

location ~ ^/images {
        if ($is_args != "")
rewrite ^ $uri? permanent;
share|improve this question
If it's about caching, you could have /images use a different cache-key (without the query args). – BraveNewCurrency May 11 '13 at 15:08
would you please give example? – imastar May 12 '13 at 1:37
location ~ ^/images { proxy_cache_key $scheme$proxy_host$uri; } # don't use $args when checking cache. – BraveNewCurrency May 18 '13 at 3:13

But for what? The file myfile.jpg the file will be opened with any parameters, added after ? in uri. Anyway, 404 will not raised. ?bla=blabla not part of path to file myfile.jpg on disk for nginx in this case. It's just a variable $args in terms of nginx config.

share|improve this answer
I've got about 500 hits/second using ?bla=blabla and it not served from cache. So i think if it will redirect to myfile.jpg my server resource will not get problem – imastar May 10 '13 at 15:26

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.