What should the rewrite rule be?

Austin Kinsella

Joined: 2007-08-05
Posts: 39
Posted: Thu, 2007-09-06 22:45

Gallery URL (optional but very useful): http://cps.itcarlow.ie/gallery/
Gallery version: 1.5.7
Apache version: Apache/2.0.55 (Ubuntu)
PHP version (don't just say PHP 4, please): 5.1.2
Graphics Toolkit: NetPBM
Operating system: Ubuntu Linux
Web browser/version (if applicable):

Please correct me if I am making false assumptions ...

As I understand it, the purpose of rewriting is that the user will see a URL such as http://cps.itcarlow.ie/gallery/NightBW, but as this is not a real directory it will be rewritten to http://cps.itcarlow.ie/gallery/view_album.php?set_albumName=NightBW so that the gallery scripts are invoked, passed the target directory and do their magic.

This is not working for me, and I have temporarily disabled rewriting in config.php with $gallery->app->feature["rewrite"] = 0; as described in the FAQ. I would like to get it working.

In the sites enabled file for my virtual site (cps.itcarlow.ie) I find these entries for rewriting:
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
and I don't think they are overridden anywhere by any .htaccess files. A quick look at the mod_rewrite docs suggests that this rule doesn't actually do anything. Should there be a different rule? Or in a different place? Has anyone a sample?

Thanks.
AK

 
h0bbel
h0bbel's picture

Joined: 2002-07-28
Posts: 13451
Posted: Thu, 2007-09-06 23:15

Re-running the config wizard should recreate the rewrite rules in your gallery/.htaccess file. If it doesn't work after doing that, check your Apache error logs for clues as to what is wrong.


h0bbel - Gallery Team
If you found my help useful, please consider donating to Gallery
http://h0bbel.p0ggel.org

 
Austin Kinsella

Joined: 2007-08-05
Posts: 39
Posted: Thu, 2007-09-06 23:48

Ah. In /etc/gallery there is a .htaccess with a more complex set of rules. There is also an apache.conf file which sets an alias for gallery to /usr/share/gallery, which is where all the php etc files are. Is there a conflict here - will both the apache.conf AND the .htaccess files be used? Or is there a conflict between the rewrite rule in my cps.itcarlow.ie virtual host file and the rules in /etc/gallery/.htaccess?

In config.php I changed $gallery->app->feature["rewrite"] back to =1, and then in my browser refreshed the page (so the links go back to the http://cps.itcarlow.ie/gallery/NightBW form) and clicked the thumbnail. The error log shows:

File does not exist: /usr/share/gallery/NightBW, referer: http://cps.itcarlow.ie/gallery/

Thanks for your help.

AK

 
Austin Kinsella

Joined: 2007-08-05
Posts: 39
Posted: Sat, 2007-09-08 22:27

It could probably have been fixed differently, but I cured my problem by moving the Gallery files from usr/share/gallery to /var/www/cps/gallery - in the filepath of my virtual host, which is of course where the installation docs say to put it. Rewriting is now functioning correctly.

AK