.htaccess issue with 1.3.2

ffletch2

Joined: 2002-08-16
Posts: 60
Posted: Sun, 2002-12-01 22:26

I'm have a 1.3.1 gallery running properly on win2000 server, apache 1.3.27 and php 4.2.2.

After following the steps in "UPGRADING" to upgrade, gallery first tells me that I need to rerun the config wizard because my config was created with an old version. I then run the config wizard (after putting it in config mode) and successfully save the config file. After that I put it in secure mode. At any point after this I get a 500 internel server error from apache. In my error.log file I see this:
<bunch of junk> .htaccess: RewriteBase: argument is not a valid URL

I did what the troubleshooting part of the FAQ said and deleted the .htaccess file and everything worked just fine. However I'd like to not have to do that every time I reconfigure gallery. I'd also like to have the mod_rewrite functionality. Anyone else have any ideas? TIA.

 
alindeman
alindeman's picture

Joined: 2002-10-06
Posts: 8194
Posted: Sun, 2002-12-01 22:55

What do you mean, do that every time?

 
ffletch2

Joined: 2002-08-16
Posts: 60
Posted: Sun, 2002-12-01 23:36

Sorry, I meant every time I go to change the gallery configuration. I changed my original posting. I also need the rewrite functionality (none of my links work when I delete the .htaccess file).

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Mon, 2002-12-02 19:17

Hi. It sounds like your RewriteBase value being created by Gallery isn't correct. Hmm. This could happen for several reasons. Please post the relevant contents of your .htaccess file, as well as a little about your directory structure (i.e. where the Gallery directory is in relation to your base web directory, etc.). Was this working before with 1.3.1? Do you have a backup of the old .htaccess file that you could post as well for comparison?

(In the mean time, you can turn off mod_rewrite temporarily until this all gets fixed. Change the value of $gallery->app->feature["rewrite"] to zero in your config.php.)

-Beckett (

)

 
ffletch2

Joined: 2002-08-16
Posts: 60
Posted: Mon, 2002-12-02 19:34

Yes this was working fine with 1.3.1.
I'm pretty sure that there is a problem with the .htaccess file. I've attached the two files below (OLD is the one that worked with 1.3.1 and NEW is the one generated for 1.3.2 after the config wizard). The problem looks like its in the Rewritebase line. But I have no idea where the old one came from (pictures).

The path to all of the gallery files is this:
D:Datapublic_htmlpix
The path to my albums is this:
D:Datapublic_htmlpixalbums

Here is OLD .htaccess:
php_value post_max_size 20971520
php_value upload_max_filesize 20971520
php_flag magic_quotes_gpc off

Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /pictures/
RewriteRule ^([^.?/]+)/([0-9]+)$ /view_photo.php?set_albumName=$1&amp;index=$2 [QSA]
RewriteRule ^([^.?/]+)/([A-Za-z_0-9-]+)$ /view_photo.php?set_albumName=$1&amp;id=$2 [QSA]
RewriteRule ^([^.?/]+)/$ /$1 [R]
RewriteRule ^([^.?/]+)$ /view_album.php?set_albumName=$1 [QSA]
</IfModule>

Here is NEW .htaccess:
php_value post_max_size 20971520
php_value upload_max_filesize 20971520
php_value magic_quotes_gpc off

Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^([^.?/]+)/([0-9]+)$ /view_photo.php?set_albumName=$1&amp;index=$2 [QSA]
RewriteRule ^([^.?/]+)/([A-Za-z_0-9-]+)$ /view_photo.php?set_albumName=$1&amp;id=$2 [QSA]
RewriteRule ^([^.?/]+)/$ /$1 [R]
RewriteRule ^([^.?/]+)$ /view_album.php?set_albumName=$1 [QSA]
</IfModule>

Quote:
Hi. It sounds like your RewriteBase value being created by Gallery isn't correct. Hmm. This could happen for several reasons. Please post the relevant contents of your .htaccess file, as well as a little about your directory structure (i.e. where the Gallery directory is in relation to your base web directory, etc.). Was this working before with 1.3.1? Do you have a backup of the old .htaccess file that you could post as well for comparison?

(In the mean time, you can turn off mod_rewrite temporarily until this all gets fixed. Change the value of $gallery->app->feature["rewrite"] to zero in your config.php.)

-Beckett (

)

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Mon, 2002-12-02 20:10

Truly bizarre. You should change your *new* .htaccess file to have:

RewriteBase /pix/

Then... Remove the backslash ("") in front of each of the four RewriteRules:

RewriteRule ^([^.?/]+)/([0-9]+)$ /pix/view_photo.php......
RewriteRule ^([^.?/]+)/([A-Za-z_0-9-]+)$ /pix/view_photo.php.......
RewriteRule ^([^.?/]+)/$ /pix/$1 [R]
RewriteRule ^([^.?/]+)$ /pix/view_album.php.......

Note that you might be able to get away without the "/pix" for each RewriteRule provided it's in the RewriteBase. Try it both ways. (Such is the voodoo of mod_rewrite). :roll:

And keep this copy around, because every time you run the Config. Wizard, it'll overwrite this file again. I'm really not sure why this happened. As for the "/pictures/" it sounds like you changed the name of your albums directory at some point without running the Config Wizard again. But that doesn't explain why it was working with the old file. Very strange.

Let us know if it starts working again, and sorry it's not a more solid solution! (Anybody?)
-Beckett (

)

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Mon, 2002-12-02 21:12

Unless you have changed your directory structure or anything, you can
use your old .htaccess file without issues. Either you forgot to fill out a field
in configuration, or you typo'd or it's broken. Anyhow, assuming everything
structure-wise is the same, just use your old .htaccess file with the proper
rewrite rules.

 
ffletch2

Joined: 2002-08-16
Posts: 60
Posted: Mon, 2002-12-02 22:10

I think I see what this is related to at least. The root of my website (www.mysite.com for instance) is my actual gallery files. I'm not sure where (in what file) it happens, but something has changed in the way that this .htaccess file is generated. I have gone back and forth between my .htaccess files and I have been able to make it work with the .htaccess file at the bottom of this post. There seems to be two problems:
1) Why can I access my gallery when the RewriteBase line points to a non existant direcotry?
2) Gallery seems to create the .htaccess file incorrectly when gallery is the root of a website (at least on my platform). I wonder if there are other people who have gallery at the root of a website and have run into this problem when upgrading.

I'd look at the code where gallery generates this .htaccess file, but I'm not sure in what file it happens. Can someone point me to this file?

php_value post_max_size 20971520
php_value upload_max_filesize 20971520
php_flag magic_quotes_gpc off

Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase //
RewriteRule ^([^.?/]+)/([0-9]+)$ /view_photo.php?set_albumName=$1&amp;index=$2 [QSA]
RewriteRule ^([^.?/]+)/([A-Za-z_0-9-]+)$ /view_photo.php?set_albumName=$1&amp;id=$2 [QSA]
RewriteRule ^([^.?/]+)/$ /$1 [R]
RewriteRule ^([^.?/]+)$ /view_album.php?set_albumName=$1 [QSA]
</IfModule>

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Mon, 2002-12-02 22:30

Hmm. My gallery is at the root (I use a VirtualHost since it's a subdomain).

Here's what's in my .htaccess file, run through the Config Wizard (of course, this is running on Linux, not Windows), which works just fine:

RewriteBase /
RewriteRule ^([^.?/]+)/([0-9]+)$ /view_photo.php?set_albumName=$1&amp;index=$
2 [QSA]
RewriteRule ^([^.?/]+)/([A-Za-z_0-9-]+)$ /view_photo.php?set_albumName=$1
&amp;id=$2 [QSA]
RewriteRule ^([^.?/]+)/$ /$1 [R]
RewriteRule ^([^.?/]+)$ /view_album.php?set_albumName=$1 [QSA]

-Beckett (

)

 
alindeman
alindeman's picture

Joined: 2002-10-06
Posts: 8194
Posted: Mon, 2002-12-02 22:33

You might want to clean out your .htaccess file, put Gallery into config mode (make sure the .htaccess file is chmodded correctly) and re-run the configuration script.

 
ffletch2

Joined: 2002-08-16
Posts: 60
Posted: Mon, 2002-12-02 22:47

I have reconfigured gallery several times now and each time the same .htaccess file is created. It appears to be a forward slash - backslash issue. I'll bet it only happens on windows. I have other virtual sites that are subdomains also, however in each of their cases they are not the root of the website and everything works fine. I guess I'll chalk it up to a windows issue. Thanks for everyone's help, at least I know how to make it run now.

Doubt anyone will answer this, but:

Is there ANYONE out there that is running gallery on win2000 (or any windows) and apache that uses gallery in the root of their website? If so please reply and let us know if yours works.