mod_rewrite problems

I've been a log time user to ZenPhoto and wanted to say great work Tris.

I just moved my site to a new hosting server. Now I'm having problems with mod_rewrite and ZenPhoto in only one case. Zenphoto and mod_rewrite seems to work for pretty much everything. The only time I have problems is when I'm in a gallery and I click on one of the thumbnail images to bring up the page with the bigger picture. In IE, it just hangs. In Firefox, I get a message saying "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

When I turn off mod_rewrite in the zp-config, this works without a problem. Only when mod_rewrite is enabled do I have this problem, and it's only in this instance. All my other redirects seem to work.

I'm assuming I have a problem with this rule:
RewriteRule ^([^/]+)/([^/\\]+)$ index.php?album=$1&image=$2 [L,QSA]

Can someone give me some pointers? Thanks.

Here is what is included in my htaccess file:

# htaccess file for zenphoto
# NOTE: Change the RewriteBase below to the absolute path to your zenphoto directory.

<IfModule mod_rewrite.c>
RewriteEngine On

# !!! Change this to the web path (eg: http://www.example.com/photos --> /photos) !!!
RewriteBase /album

RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
RewriteCond %{REQUEST_FILENAME} -d [NC]
RewriteRule ^.*$ - [R,L]

RewriteRule ^admin/?$ zp-files/admin.php [R,L]

RewriteRule ^page/([0-9]+)/?$ index.php?page=$1 [L,QSA]
RewriteRule ^page/([A-Za-z0-9\-_]+)/?$ index.php?p=$1 [L,QSA]
RewriteRule ^([^/]+)/?$ index.php?album=$1 [L,QSA]
RewriteRule ^([^/]+)/page/([0-9]+)/?$ index.php?album=$1&page=$2 [L,QSA]
RewriteRule ^([^/]+)/image/(thumb|[0-9]{1,4})/([^/\\]+)$ zp-files/i.php?a=$1&i=$3&s=$2 [L,QSA]
RewriteRule ^([^/]+)/image/([^/\\]+)$ albums/$1/$2 [L]
RewriteRule ^([^/]+)/([^/\\]+)$ index.php?album=$1&image=$2 [L,QSA]

</IfModule>

Comments

  • I have the exact problem. And I found if the album title has space in them, such as a title "good pic", then I will get the redirect error. but if the title doesn't have space such as "goodpic", then it's fine. Don't know what's wrong.
  • hwanch Member
    Thanks. I guess I have to rename all my folders then. This shouldn't be a problem. Is anyone else having this problem? It used to work perfectly fine when I was usigg dreamhost but it seemed to have "broke" with hostpc.

    For the meantime, I'll try renaming my folders and see if that works. Thanks.
  • SubJunk Member
    I realize this isn't a fix but it could be good to temporarily rename folders with code spacing, so "My Folder" changes to `My Folder`. Not sure if that will work (whether it will just show the word ` ` but if it works it will be better than changing all the album titles to be only one word
  • That would be:
    `My%20Folder`
    as you can use & or ; in folder names
  • hwanch Member
    Thanks for the recommendations. I couldn't figure out a solution either so I just took the workaround of renaming my folders to use an underscore (_) in place of spaces.

    I noticed that it's not limited to spaces, but any character that gets URL encoded. So spaces, apostrophes, commas, parentheses, etc. will break the mod_rewrite. I've stripped my folders from using any "special" characters and now my albums work.

    Just in case anyone else has this problem, you can try this work around.
Sign In or Register to comment.