How to fix Mod_Security error message on image pages

For anyone getting the following error message on their server when clicking on an image page, I found a solution that works for me and wanted to pass it along-

"An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security."

I'm on Hostgator, and after a recent update on their servers to PHP 7.4.16, Zenphoto would no longer run (my version was a few behind). After updating to the latest 1.5.7, whenever I clicked on an image page they would fail to load and I would get that error message. I saw other suggestions saying that you have to turn off mod_security in .htaccess, or turn off mod_rewrite under the URL options, but that was not the case for my server.

To fix the issue, what you have to do is not use .php as a suffix under Options-URL options:mod_rewrite suffix. I was able to use .html or leave it blank and both worked. That way I was able to still use mod_rewrite to get "nice cruft-free URLs".

I've been using the previous option for years, so I'm not sure if it was the PHP update, Zenphoto updates, or a new server security setting that caused the issue, but I wanted to pass along the solution I found if it helps anyone else.

Comments

  • acrylian Administrator, Developer

    Thanks. .php was the default previously. But for some time we use .html for this reason and also recommend it. We didn't change it automatically because that would change URLs and impact SEO without redirections.

    And also never leave thte modrewrite suffix blank as that also may trigger security measures and also SEO issues as it then may look like a script page pretending to be an image.

Sign In or Register to comment.