Hi. This is a great system you have provided. Thanks!
I have a problem getting mod_rewrite to work:
Whenever I check the box in admin to enable it, and save changes, I get a 404 and the changes arent saved.
I have made sure that my .htaccess points to the zenphoto root, and my server support people tell me mod_rewrite is definitely enabled..
I also noticed I happen to have a .htaccess in both the web root on my server space and the root of zenphoto itself.. Is this right?
I have exhausted the forum to try and find an answer for my specific problem, but no luck!
thanks for any help at all!
`
RewriteEngine On
RewriteBase /zenphoto
RewriteRule ^admin/?$ zp-core/admin.php [R,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^albums/?(.+/?)?$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteRule index.php$ index.php [L,QSA]
RewriteRule ^page/([0-9]+)/?$ index.php?page=$1 [L,QSA]
RewriteRule ^page/([A-Za-z0-9-]+)/?$ index.php?p=$1 [L,QSA]
RewriteRule ^page/([A-Za-z0-9-]+)/([0-9]+)/?$ index.php?p=$1&page=$2 [L,QSA]
RewriteRule ^(.)/page/([0-9]+)/?$ index.php?album=$1&page=$2 [L,QSA]
RewriteRule ^(.)/page/([A-Za-z0-9_-]+)/?$ index.php?album=$1&p=$2 [L,QSA]
RewriteRule ^page/search/fields([0-9]+)/(.)/([0-9]+)/?$ index.php?p=search&searchfields=$1&words=$2&page=$3 [L,QSA]
RewriteRule ^page/search/fields([0-9]+)/(.)/?$ index.php?p=search&searchfields=$1&words=$2 [L,QSA]
RewriteRule ^page/search/archive/(.)/([0-9]+)/?$ index.php?p=search&date=$1&page=$2 [L,QSA]
RewriteRule ^page/search/archive/(.)/?$ index.php?p=search&date=$1 [L,QSA]
RewriteRule ^page/search/tags/(.)/([0-9]+)/?$ index.php?p=search&searchfields=tags&words=$1&page=$2 [L,QSA]
RewriteRule ^page/search/tags/(.)/?$ index.php?p=search&searchfields=tags&words=$1 [L,QSA]
RewriteRule ^page/search/(.)/([0-9]+)/?$ index.php?p=search&words=$1&page=$2 [L,QSA]
RewriteRule ^page/search/(.)/?$ index.php?p=search&words=$1 [L,QSA]
RewriteRule ^pages/?$ index.php?p=pages [L,QSA]
RewriteRule ^pages/(.)/?$ index.php?p=pages&title=$1 [L,QSA]
RewriteRule ^news/?$ index.php?p=news [L,QSA]
RewriteRule ^news/([0-9]+)/?$ index.php?p=news&page=$1 [L,QSA]
RewriteRule ^news/category/(.)/([0-9]+)/?$ index.php?p=news&category=$1&page=$2 [L,QSA]
RewriteRule ^news/category/(.)/?$ index.php?p=news&category=$1 [L,QSA]
RewriteRule ^news/archive/(.)/([0-9]+)/?$ index.php?p=news&date=$1&page=$2 [L,QSA]
RewriteRule ^news/archive/(.)/?$ index.php?p=news&date=$1 [L,QSA]
RewriteRule ^news/(.)/?$ index.php?p=news&title=$1 [L,QSA]
RewriteRule ^(.)/image/(thumb|[0-9]{1,4})/([^/\]+)$ zp-core/i.php?a=$1&i=$3&s=$2 [L,QSA]
RewriteRule ^(.)/image/([^/\]+)$ zp-core/i.php?a=$1&i=$2 [L,QSA]
RewriteRule ^(.*)/album/(thumb|[0-9]{1,4})/([^/\]+)$ zp-core/i.php?a=$1&i=$3&s=$2&album=true [L,QSA]
RewriteRule ^(.*)/?$ index.php?album=$1 [L,QSA]
`
Quote:I also noticed I happen to have a .htaccess in both the web root on my server space and the root of zenphoto itself.. Is this right?
Zenphoto places the .htaccess in the root of the zenphoto install. Any .htaccess superior to that is from some place else. It is certainly possible for such a .htaccess to interfer with Zenphoto's rules.
Do you get the 404 error when saving the mod_rewrite option? Of on a different page?
In addition, what version of Zenphoto are you running? From the .htaccess file you listed it is an old one that should have been updated to prevent the recent security breach.
Note also that the security breach did cause problems with redirections. Have you "cleansed" your site?
Well, I was on 1.2.8 at the beginning of the week, and have been trying to go through each subsequent update one by one, but my server has a habit of cutting me off halfway through uploads, which has put me off upgrading unless absolutely necessary for a little while..
I'm on 1.3 now.
I get a 404 when saving the option. When i return to the relevant page afterwards the box is still unchecked..
You should be able to go directly to 1.4.1.6 [or better still, 1.4. RC3] straight from there.
The admin pages are not using mod_rewrite, so that is not the issue then. Maybe a file permissions issue, but that seems unlikely since you can visit the page before the save.
What is showing in the browser's address bar when you get the 404 error?
If your site was hit by the hack, one of the things it did was spray .htaccess files all about. So one of those might be still around.
The link you show is pretty straight forward. So long as the admin-options.php script is present there should be no 404 errors. And we know it is present since you can try to save the option. This all leads me to suspect contaminated files in your installation.
You should remove all the files from your site and replace them with known good backups or with the new install files. That is the "cleansing" I mentioned.
Ok, this is a bit of a nightmare!
I have DELETED my entire zenphoto folder, after backing up my albums, some custom template_functions and my theme files.
I have DELETED my mySQL database and made a new one.
So now I am going to try and start where i left off. I just performed a clean install of 1.2.8 [4881] since it was the last version that worked with my current theme. I intend to upgrade, but one stage at a time so i can iron out theme bugs as I go.
I have uploaded one album for testing purposes, and i've noticed that mod_rewrite is working!? Well, it is at least trying to access http://domain.co.uk/myalbum/ from the gallery index, but then is reaching a 404.
I tried to turn off mod_rewrite in the admin, but when i click save on that tab, even after changing nothing, i get:
`
Not Acceptable
An appropriate representation of the requested resource /zp-core/admin-options.php could not be found on this server.
`
I would happily settle for just getting the site working so i can begin to rebuild.
Thanks for any help, I need it!
IF modrewrite is enabled on the admin options you also need a valid .htaccess file. Zenphoto 1.2.8 is quite old so you probably have to create it yourself using the template file within /zp-core. (I don't remember)
On current releases the setup script will warn about a missing one and offer to create it.
yeah it has!
here is what it looks like right now:
`
RewriteEngine On
RewriteBase /zenphoto
RewriteRule ^admin/?$ zp-core/admin.php [R,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^albums/?(.+/?)?$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteRule index.php$ index.php [L,QSA]
RewriteRule ^page/([0-9]+)/?$ index.php?page=$1 [L,QSA]
RewriteRule ^page/([A-Za-z0-9-]+)/?$ index.php?p=$1 [L,QSA]
RewriteRule ^page/([A-Za-z0-9-]+)/([0-9]+)/?$ index.php?p=$1&page=$2 [L,QSA]
RewriteRule ^(.)/page/([0-9]+)/?$ index.php?album=$1&page=$2 [L,QSA]
RewriteRule ^(.)/page/([A-Za-z0-9_-]+)/?$ index.php?album=$1&p=$2 [L,QSA]
RewriteRule ^page/search/fields([0-9]+)/(.)/([0-9]+)/?$ index.php?p=search&searchfields=$1&words=$2&page=$3 [L,QSA]
RewriteRule ^page/search/fields([0-9]+)/(.)/?$ index.php?p=search&searchfields=$1&words=$2 [L,QSA]
RewriteRule ^page/search/archive/(.)/([0-9]+)/?$ index.php?p=search&date=$1&page=$2 [L,QSA]
RewriteRule ^page/search/archive/(.)/?$ index.php?p=search&date=$1 [L,QSA]
RewriteRule ^page/search/tags/(.)/([0-9]+)/?$ index.php?p=search&searchfields=tags&words=$1&page=$2 [L,QSA]
RewriteRule ^page/search/tags/(.)/?$ index.php?p=search&searchfields=tags&words=$1 [L,QSA]
RewriteRule ^page/search/(.)/([0-9]+)/?$ index.php?p=search&words=$1&page=$2 [L,QSA]
RewriteRule ^page/search/(.)/?$ index.php?p=search&words=$1 [L,QSA]
RewriteRule ^pages/?$ index.php?p=pages [L,QSA]
RewriteRule ^pages/(.)/?$ index.php?p=pages&title=$1 [L,QSA]
RewriteRule ^news/?$ index.php?p=news [L,QSA]
RewriteRule ^news/([0-9]+)/?$ index.php?p=news&page=$1 [L,QSA]
RewriteRule ^news/category/(.)/([0-9]+)/?$ index.php?p=news&category=$1&page=$2 [L,QSA]
RewriteRule ^news/category/(.)/?$ index.php?p=news&category=$1 [L,QSA]
RewriteRule ^news/archive/(.)/([0-9]+)/?$ index.php?p=news&date=$1&page=$2 [L,QSA]
RewriteRule ^news/archive/(.)/?$ index.php?p=news&date=$1 [L,QSA]
RewriteRule ^news/(.)/?$ index.php?p=news&title=$1 [L,QSA]
RewriteRule ^(.)/image/(thumb|[0-9]{1,4})/([^/\]+)$ zp-core/i.php?a=$1&i=$3&s=$2 [L,QSA]
RewriteRule ^(.)/image/([^/\]+)$ zp-core/i.php?a=$1&i=$2 [L,QSA]
RewriteRule ^(.*)/album/(thumb|[0-9]{1,4})/([^/\]+)$ zp-core/i.php?a=$1&i=$3&s=$2&album=true [L,QSA]
RewriteRule ^(.*)/?$ index.php?album=$1 [L,QSA]
`
I'm a little concerned that i can't just turn it off through the control panel (or indeed even click save in the general tab of the options) without getting sent to this url:
zp-core/admin-options.php?action=saveoptions
and returning:
`
Not Acceptable
An appropriate representation of the requested resource /zp-core/admin-options.php could not be found on this server.
`
Ok, an update:
I have noted that when I load zenpage via my root domain:
maindomain.com/zenphoto
The mod_rewrite works and I get no 404s, however i still can't use the control panel general options tab to turn it off, i get a 'not acceptable' error.
My zenphoto folder is in the web root of my site, and I have a secondary domain pointed to it:
2nddomain.com = maindomain.com/zenphoto
im so confused and i just want the site live again, mod_rewrite or not.
You can disable modrewrite on the options, then the htaccess file is simply ignored.
But if you use modrewrite you have to decide what domain you wish to use. The htaccess file can have only one rewrite base. (/ or /zenphoto in your examples). If you use both you need to setup redirection rules to make one domain the main one. Recommended for SEO anyway.