Server Fault is a question and answer site for system and network administrators. 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

So I've been playing with rewrite for awhile, and I can't get it.

Basically, when a user visits I want it to actually display the results of

This was what I had before I finally gave up:

rewrite "/images/([a-zA-Z0-9_-]+).png" /home/wwwroot/stats.php?user=$1;

Can anyone tell me what I'm doing wrong?

share|improve this question
up vote 0 down vote accepted

Don't use the file path for your replacement. Try this:

rewrite ^/images/([-\w]+)\.png$ /stats.php?user=$1;

And you'll want to make sure that your PHP code is setting the right MIME type on the response.

share|improve this answer
That absolutely did the trick. Thank you so much! – Rob Jan 16 '12 at 7:27

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.