Long time user, first time mod_rewrite attempt

Hi all,

http://www.generalmagic.org has been running for a while (with sub-albums now) but it's the first time I tackle the issue of mod_rewrite/.htaccess.

I have turned on mod_rewrite in the zp-config.php file and modified my .htaccess (in /var/www/gallery with:

RewriteBase /gallery

I have switched to the testing theme to eliminate any issue that might be theme related.

http://www.generalmagic.org/gallery/ works but clicking on any album doesn't.

Where should I look first ?

Comments

  • @edasque-

    What version are you running. If not 1.8.0.2, then you should upgrade. Modrewrite and subalbums didn't work "perfectly" before version 1.0.7.

    If you are on 1.8.0.2, then let us know, and we can help you further from there.
  • I am running 1.0.8. If I need to move to 1.0.8.2 I will, let me know.
  • Nope, 1.0.8 should work. Hmmm. How about upgrading to 1.0.8.2 and see what happens. Tristan included some fixes in there that may be what you are experiencing. Should be just a file replacement in the /zen directory for your current files.

    Try that, and let us know.
  • So I updated to 1.0.8.2:

    cp index.php /var/www/gallery
    cp -r zen/* /var/www/gallery/zen

    Note that the version on the admin tool still says 1.0.8, I am not sure that's right.

    The problem remains. Don't know if it's subalbums related as clicking on a main album results in the error.

    http://www.generalmagic.org/gallery/ -> works
    http://www.generalmagic.org/gallery/page/2/ -> does not work
    http://www.generalmagic.org/gallery/Portfolio 2005/ -> has a space, doesn't work
    http://www.generalmagic.org/gallery/Others -> no space, dooesn't work
    http://www.generalmagic.org/gallery/Underwater/KeyLargo2006/Reef/2006-11-03_CRW_2984.jpg.php --> image in sub album, doesn't work but .php does show up now.

    http://www.generalmagic.org/gallery/zen/admin.php works by the way.

    So it might not be related to sub-albums and spacing. I am betting on user error in mod_rewrite/.htaccess/zenphoto configuration.

    Any idea ?
  • for reference, this is my .htaccess:

    # 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 /gallery
    ####

    RewriteRule ^admin/?$ zen/admin.php [R,L]

    RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
    RewriteCond %{REQUEST_FILENAME} -d [NC]
    RewriteRule ^.*$ - [R,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/([0-9]+)/?$ index.php?album=$1&page=$2 [L,QSA]
    RewriteRule ^(.*)/image/(thumb|[0-9]{1,4})/([^/\\]+)$ zen/i.php?a=$1&i=$3&s=$2 [L,QSA]
    RewriteRule ^(.*)/image/([^/\\]+)$ zen/i.php?a=$1&i=$2 [L,QSA]

    # Catch-all - everything else gets handled in PHP for compatibility.
    RewriteRule ^(.*)/?$ index.php?album=$1 [L,QSA]
    </IfModule>
  • Could mod_rewrite not be on in my config. Is there a way to turn it on at the apache level ?
  • mod_rewrite, if it's on in zp_config (set to true), then is on for zenphoto. I can't imagine your host doesn't support it.

    And the admin will say 1.0.8, since the functions.php variable for version # is 1.0.8. I changed mine manually, but that's just a cosmetic thing I do to keep track of what version I'm using.
  • so any idea ?

    I noticed that an old URL such as:

    http://www.generalmagic.org/gallery/index.php?album=Portfolio+2007/Rassain

    does get rewritten as (what I imagine is correctly) :

    http://www.generalmagic.org/gallery/Portfolio 2007/Rassain

    Which would seem to indicate that my config doesn't seem to be able to deal with that path ?
  • I don't have any ideas on this one. Most of what you're explaining behavior-wise should be fixed with 1.0.8.2.

    Any thoughts Tristan?
  • I decided to do a full install (instead of upgrade after upgrade since 1.0) of zenphoto 1.0.8.2 just using my existing zp-config.php, database and albums directory. Since I nixed the cache, the thumbnails don't appear anymore and I still have the URL issue.
  • Did you update the zp_config to the current one in the 1.0.8.2 distribution, or are you still using the older version, as there have been some changes in that file recently.
  • I had. I just rebuilt it from scratch and ended up with the same issue.
  • trisweb Administrator
    It's as simple as mod_rewrite not being enabled on your host. Give us a `<?php phpinfo(); ?>` to verify, but I'll bet you that's it.

    That should be your first clue when none of the paths work ;-)

    Also, your cache directory is not writable, but that's an entirely different problem :-)

    http://www.generalmagic.org/gallery/zen/i.php?a=Portfolio 2007/Rassain&#38;i=IMG_7493_4_5.jpg&#38;s=thumb
  • Ok, the cache thing happened when I reinstalled an hour ago. Sorry about that. Should be fixed.

    Here's a phpinfo: http://www.generalmagic.org/phpinfo.php
  • Ok, I have enabled mod_rewrite by moving the rewrite.load file to mods-enabled and it seems mod-rewrite is now enabled from the phpinfo.php file but the problem remains ?
  • trisweb Administrator
    Seems like it's still not getting the mod_rewrite enabled.

    You have your own server (or VPS) (Debian too, nice) so you'll probably need to add

    `AllowOverride all`

    in your directory configuration block to enable the use of .htaccess files to override the httpd conf. :-) Ex:

    `

    AllowOverride All

    Order allow,deny

    Allow from all

    Options Indexes FollowSymLinks

    `
  • Awesome. That worked. So to sum it up I didn't have mod_rewrite enabled and didn't have it configured to allow overrides in my virtual host configuration.

    Thanks a bunch, you two !
  • trisweb Administrator
    You're welcome!

    Yeah, I had the same problem setting up my server. You have to configure a lot of things manually that you take for granted on shared hosting :)
Sign In or Register to comment.