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!
`
# htaccess file version 1.2.8.0;
# When Zenphoto requires changes to the rewrite rules:
# First make a copy of this file as 'oldhtaccess' in the zp-core folder so setup can test for unmodified files
# Update the above and the define in setup.php
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]
#### Rewrite rule addition for search
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]
#### Rewrite additions for zenpage
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]
####
# Catch-all - everything else gets handled in PHP for compatibility.
RewriteRule ^(.*)/?$ index.php?album=$1 [L,QSA]
`
Comments
On some server you have to put this code
`Options +FollowSymlinks` before `RewriteEngine On`
Maybe is the solution.
Laurent
An appropriate representation of the requested resource /zp-core/admin-options.php could not be found on this server.
Also, i noted on a recent update, in the setup process, zenphoto confirmed various things about mod_rewrite on my server to be a.ok?
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?
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..
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?
The URL i get is:
mydomain.com/zp-core/admin-options.php?action=saveoptions
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.
thanks!
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!
On current releases the setup script will warn about a missing one and offer to create it.
here is what it looks like right now:
`
# htaccess file version 1.2.8.0;
# When Zenphoto requires changes to the rewrite rules:
# First make a copy of this file as 'oldhtaccess' in the zp-core folder so setup can test for unmodified files
# Update the above and the define in setup.php
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]
#### Rewrite rule addition for search
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]
#### Rewrite additions for zenpage
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]
####
# Catch-all - everything else gets handled in PHP for compatibility.
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.
`
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.
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.
I can't even change the timezone or anything!
I fixed mod_rewrite, I changed the .htaccess to / instead of /zenphoto. That works now. However I still can't save changes in the general options tab. I get an error:
`
The Zenphoto object you are requesting cannot be found.
Album: zp-core
Image: admin-options
Page:
`
at the page:
domain.com/zp-core/admin-options.php?action=saveoptions
any idea which file might be missing/corrupted? Hopefully i only have to swap a few clean files but I don't know where to start!
Failing that, is there any other manual way to change the date format for my site?
So, bottom line, One and only one domain. Certainly at least for access to the back end.
The rest of the back end seems to work perfectly, the site works perfectly. Only the general tab within the options page returns this error. And only when i click save options.
The url for the general options tab is:
http://domain.com/zp-core/admin-options.php?page=options&tab=general
And it loads fine. But then after clicking save, on that tab, I get this message:
Not Acceptable
An appropriate representation of the requested resource /zp-core/admin-options.php could not be found on this server.
from this URL:
http://domain.com/zp-core/admin-options.php?action=saveoptions
What confuses me is that these URLS both check out fine, and the rest of the options tabs and admin in general works fine..?
As far as I can tell from admin-options.php, it must be something below line 44?
`
/*** General options ***/
if (isset($_POST['savegeneraloptions'])) {
if (isset($_POST['allowed_tags_reset'])) {
setOption('allowed_tags', getOption('allowed_tags_default'));
} else {
$tags = $_POST['allowed_tags'];
$test = "(".$tags.")";
$a = parseAllowedTags($test);
if ($a !== false) {
setOption('allowed_tags', $tags);
$notify = '';
} else {
$notify = '?tag_parse_error';
}
}
setBoolOption('mod_rewrite', isset($_POST['mod_rewrite']));
setOption('mod_rewrite_image_suffix', sanitize($_POST['mod_rewrite_image_suffix'],3));
if (isset($_POST['time_zone'])) {
setOption('time_zone', $tz = sanitize($_POST['time_zone'], 3));
$offset = 0;
} else {
$offset = sanitize($_POST['time_offset'],3);
}
setOption('time_offset', $offset);
setOption('server_protocol', $protocol = sanitize($_POST['server_protocol'],3));
if ($protocol == 'http') {
zp_setcookie("zenphoto_ssl", "", time()-368000, $cookiepath);
}
setOption('charset', sanitize($_POST['charset']),3);
setOption('site_email', sanitize($_POST['site_email']),3);
setBoolOption('tinyMCEPresent', isset($_POST['tinyMCEPresent']));
$oldloc = getOption('locale', true); // get the option as stored in the database, not what might have been set by a cookie
$newloc = sanitize($_POST['locale'],3);
if ($newloc != $oldloc) {
$cookiepath = WEBPATH;
if (WEBPATH == '') { $cookiepath = '/'; }
zp_setCookie('dynamic_locale', $newloc, time()-368000, $cookiepath); // clear the language cookie
$encoding = getOption('charset');
if (empty($encoding)) $encoding = 'UTF-8';
$result = setlocale(LC_ALL, $newloc.'.'.$encoding, $newloc);
if (!empty($newloc) && ($result === false)) {
$notify = '?local_failed='.$newloc;
}
setOption('locale', $newloc);
}
setBoolOption('multi_lingual', isset($_POST['multi_lingual']));
$f = sanitize($_POST['date_format_list'],3);
if ($f == 'custom') $f = sanitize($_POST['date_format'],3);
setOption('date_format', $f);
setBoolOption('UTF8_image_URI', isset($_POST['UTF8_image_URI']));
setOption('captcha', sanitize($_POST['captcha']));
setBoolOption('use_Imagick', isset($_POST['use_Imagick']));
$msg = zp_apply_filter('save_admin_general_data', '');
$returntab = "&tab=general";
}
`
But beyond that I am really out of my depth!
Thank you so much for all your help through my metamorphosis of problems! This really is an excellent system and that's why im being so persistent! Well worth a donation.
The error you are getting is from your server not Zenphoto, so it will have nothing to do with the above code.