Webmasters Stack Exchange is a question and answer site for pro webmasters. 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

I'm using the following .htaccess file in one of my subdirectories on my server:

Options +FollowSymlinks
RewriteEngine on
RewriteRule (.*)\.png generate.php?userid=$1

My non-production environment handled the above just fine without a hitch.

However, when implemented on my live production environment and accessed, the server load goes through the roof and no webpages are loaded until the process is killed (I don't actually know the process, the other administrator just does it for me.)

So, is it my production environment that is set up incorrectly or is it that my code is sloppy/incorrect?

share|improve this question
What does generate.php do? – paulmorriss Jun 3 '11 at 8:03

There is probably not enough information to rule out all possibilities but I would try two things:

  • Add the [L] flag whichs stands for last rule which will avoid the recursive evaluation.
  • Define your paths more. Particularly the target path could start with a /. This will avoid errors in case you do not use the same paths on both systems. I would also use the ^ and $ special chars to make the rule more specific. Something like:

RewriteRule ^(*.).png$ /generate.php?userid=$1 [L]

share|improve this answer

You must have done detective work to suspect that this rewrite is the cause, but do you see any similar server issues when you load the URL directly? i.e. when you go to


Look for other differences between your environments:

  • like file permissions
  • php configurations
  • what graphics libraries are installed and preferred
  • Enable rewritelog at the apache conf/vhost level and compare

You have more info than we do, but if the exact .htaccess and assuming exact apache version/config, looking at the rewrite to behave differently on live than production seems.. unlikely?

share|improve this answer
No, loading the page directly does not reproduce the problem. – esqew Jun 3 '11 at 19:13
Well, that's good info as it would really seem to knock it back to apache as you suggest. Have you been able to check out/perform the other suggestions for finding differences in your dev vs live? – Gavin C Jun 4 '11 at 16:40

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.