Mobile app version of vmapp.org
Login or Join
Moriarity557

: Is there something wrong with my .htaccess or is there something wrong server-side? I'm using the following .htaccess file in one of my subdirectories on my server: Options +FollowSymlinks RewriteEngine

@Moriarity557

Posted in: #Htaccess #ModRewrite

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

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


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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Moriarity557

2 Comments

Sorted by latest first Latest Oldest Best

 

@Goswami781

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
www.example.com/generate.php?userid=example
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?

10% popularity Vote Up Vote Down


 

@Odierno851

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= [L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme