Hi there.
I have have used zenphoto for a photographic gallery since 2007. Love it! Especially the slick integration from Lightroom!
The only thing is that for some reason (probably after an update a few months back that I didn't test, i think) whenever one clicks from the album page to an image there a 404 that is being caught by my wordpress site. Wordpress is in the root and zenphoto is under it in /photography
any suggestions as to what the deal may be? I've looked extensively though the user guide, trouble shooting, searched this forum, permissions ok, not using php safe mode, upgraded zenphoto 1.4.4, reinstalled zenphoto, created a fresh zenphoto install.... but no luck yet.
I also copied the database tables into a new database and did a fresh install in a subdomain and it was fine. Must just be a conflict because as it is under wordpress (which it has been for years now).
The wordpress /.htaccess file looks like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# no directory listing
IndexIgnore *
Options -Indexes
and the zenphoto /photography/.htaccess is standard with the setup (with RewriteBase /photography of course).
FYI, I am using the default theme (had a beautiful custom theme that matched my site, but it broke with an upgrade a year ago and haven't had a chance to fix it yet, been traveling round the world for 5 years in places with crappy internet...)
See the problem here:
http://www.exploringbliss.com/photography/Any suggestions would be greatly appreciated.
Many thanks!
Comments
I am not sure why this does not also cause issues with album links, though. You should try removing the Wordpress `.htaccess` and see if things work. If so, then you know that the above it the issue.
If that is the case you need to add a `RewriteCond` to exclude links with "photography" as the folder name. Sorry, I am not well enough versed in rewrite rules to tell you how to do this.
`RewriteRule ^photography/(.*)?/$ photography/$1 [L,R=301]`
Not sure where to place it but probably try first right after the rewrite base.
Getting closer now:
* when I delete the wordpress installation so that there is nothing in the root folder except /photography , I get the error below. And when I put wordpress back, the .htaccess catches it and redirects to the wordpress 404 page.
----------------------
Forbidden
You don't have permission to access /photography/new_zealand/20081223-NewZealand-9779.jpg.php on this server.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
----------------------
* Now here is the interesting bit: I moved my test zenphoto installation that was working fine in a subdomain from the root to /test and the SAME ERROR OCCURED! Then to double-check, I installed a completely fresh installation in a test subdomain in a subdirectory ( /test ) and i get the SAME error.
In other words, the current version of zenphoto doesn't seem to work out-of-the-box in a subdirectory! The setup works fine in root though.
Thanks for the support,
Fraser
If you move Zenphoto from and to folders and use modrewrite you always need to either run setup or change the rewritebase of the htaccess file. Otherwise it of course will not work.
On a domain/subdomain root that would be /. On a folder /<folder>.
Here is what I have found doing completely fresh installs and uploading 1 image in an album called "album".
1) On my host (rochen.com) zenphoto 1.4.4 works fine in the root using mod rewrite. ex: http://test2.exploringbliss.com/album/_MG_0930-1024.jpg.php
2) However, on my host (rochen.com) zenphoto 1.4.4 doesn't work with mod rewrite when the installation is contained in a subdirectory (it is fine without mod rewrite). ex: http://test.exploringbliss.com/test/album/_MG_0930-1024.jpg.php
3) on a local MAMP install everything is fine, both root and subdirectory installs work.
But I have no clue as to why this may be. It has been working fine on the host since 2007 until sometime recently. The only variable I know that has changed is a zenphoto upgrade. Perhaps my host has upgraded something at their end, but what and when I do not know.
My host's PHP version is 5.3.20 and MySQL version is 5.1.66 (warnings in the install). The other warning I get is because PHP display_errors [is enabled].
So do I have to downgrade zenphoto?
Thanks guys for everything so far.
-- begin paste --
You don't have permission to access /webphotos/201211a-McMichael/di_20121106_142734_mcmichael_billvazan_1989_shibagaushard.jpg.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
-- end paste --
I don't recall having that problem before. I was running on v.1.4.3.2 , and just upgraded to v.1.4.4 with the same result. When I ran the setup, it didn't like the way htaccess was configured, so it updated that.
Strangely enough, slides shows seem to work fine. Go to http://daviding.com/webphotos/201211a-McMichael , and "View Slideshow", and that works.
It's just getting from the thumbnail to image that seems to be a problem.
My versions read:
PHP version: 5.2.17
Graphics support: PHP GD library bundled (2.0.34 compatible)
supporting: gif, jpg, jpeg, png, bmp
PHP memory limit: 96M (Note: Your server might allocate less!)
MySQL version: 5.1.65
I seem to recall also having the PHP display_errors warning on setup.
-- begin paste --
We apologize for this situation. I checked Apache logs and I found that because of mod_security, that type of link .jpg.php was blocked by a mod_security rule.
I went ahead and I fixed this and now you should be able to load your website without any issue or error.
-- end paste --
Problem solved. If you have this problem, ask your hosting provider support.
Daviding, you hit the nail on the head! It's an issue with .jpg.php rewrite suffix. Funny that it works in root though...
I have this open with my host....
Maybe this would be a good thing to test in the setup checks?(although it doesn't help if your host sneaks in a mod_security rule change after you're up and running.)
Thanks all for the comments and suggestions!
Food for thought:
Would it make sense to set the default rewrite rule to .html instead of .php?
I can imagine there are more than a few hosts out there that block .jpg.php extensions for security reasons, and this took a lot of hours to trace. Most new users would probably just give up and use something else. Actually, PHP sites are often hacked using this file extension to upload rogue php code to servers that think they are images. I've seen it happen a couple of times already on CMSes that run TinyMCE, for example.
Feel free to open a ticket about that maybe to discuss this further.
Do we actually need the image suffix in the url additionally? Why not just <filename minus suffix>.<modrewrite suffix>? It's rewritten anyway.
`index.php?album=albumname&image=filename.jpg`
which is rewritten to
`/albumname/filename.jpg.php`.
So what would change if we leave one suffix out always like `/albumname/filename.php` and album links stay `/album/` since they are "directories"?
If we use `/albumname/filename.jpg` some browser/server might have issues as this is not really an image itself.
Besides I had never any issus with the two suffixes.
I think not, I think that they all will make a request of the server which will process it via the rewrite rules as needed.
And if they leave the suffix out, what file should Zenphoto look for?
So forget me thinking loud.
But anyways, for the sake of security (and potentially saving hours problem solving), I have changed my suffix to .html in the config and used this .htaccess rule to forward old .php URLs to the new location:
`RewriteRule ^(.*)\.jpg.php $1.jpg.html [R=301,L]`
btw, if mod_security is blocking .jpg.php, those requests will be blocked before the above .htaccess rule is called.
You don't have permission to access [.../imageName.jpg.php] on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
It's a server issue, not a ZenPhoto issue - it's the "imageName.jpg.php" bit that (on some servers) mod_security doesn't trust - but it can generally be sorted just by going to Admin > Options > General > URL options > mod_rewrite suffix:
and changing from .php to .html