I have a site configured with Drupal 5.1 and Gallery 2.2.1 served by Apache 2.2.4, PHP 5.2.1, MySQL 5.0.39 on Mac OS X server.

Drupal lives at: /usr/share/www/Drupal
Gallery2 lives at /usr/share/www/Drupal/Gallery2
G2Data lives at /usr/share/www/G2Data

DocumentRoot is /usr/share/www/Drupal

www.example.com is the main site.
www.example.com/gallery2 gets one to the gallery2 non-embeded site.
www.example.com/gallery gets one to the embeded gallery site.

Drupal has Clean URLs enabled and works fine.

With URL Rewrite enabled on Gallery2, the non-embeded site works fine.

With URL Rewrite disabled on Gallery2 the embeded site works fine.
Generated URLs are: www.example.com/index.php?q=gallery&g2_itemId=25

With URL Rewrite enabled on Gallery2, the embeded site allows one to display the album page, but selecting an album takes one to a page not found error. Only the Header portion of the drupal site gets displayed, the left, center and right pages columns are gone, just the page not found.

The gallery2 non-embeded URL Rewrite enabled URL is: www.example.com/gallery2/v/GalleryName
An image in the gallery is: www.example.com/gallery2/v/GalleryName/Image.jpg.html

The URL that is generated by selecting the album from the embeded link is: www.example.com/v/GalleryName
If one tries www.example.com/gallery/v/GalleryName/Image.jpg.html one does not get the image, but just the same album selection page that one gets with www.example.com/gallery.

I did re-save the gallery module setting each time I changed the gallery2 URL Rewrite settings. Here are the results of that:
Embedded Gallery2 Status:
'URI of Gallery2' variable: Success
PHP Memory Limit: Success
Gallery2 Init: Success
Gallery2 Image Block Module Status: Success
Gallery2 Image Frame Module Status: Success
Gallery2 URL Rewrite Module Status: Success
Gallery2 URL Rewrite Module Auto-Configuration: Success
Overall Status: Success
The configuration options have been saved.

With URL Rewrite off:
Embedded Gallery2 Status:
'URI of Gallery2' variable: Success
PHP Memory Limit: Success
Gallery2 Init: Success
Gallery2 Image Block Module Status: Success
Gallery2 Image Frame Module Status: Success
Gallery2 URL Rewrite Module Status: Advisory
Either the URL rewrite module is not installed or the version is too old.
Overall Status: Success
The configuration options have been saved.

Thanks for your great work and thanks in advance for all your help. :-)

BTW, do you plan to provide more integrated support for 2.2.1 features like dynamic albums and image tags?

/carmi
P.S. Thought I had submitted this full version before, but couldn't find it, so if this is a duplicate, just delete it and my apologies.

CommentFileSizeAuthor
#12 htaccess_1.txt5.15 KB1kenthomas
#3 htaccess2.txt3.46 KBbarkbarkuk

Comments

mjohnq3’s picture

Subscribing

kiz_0987’s picture

Great description of your problem. Can you please also post your .htaccess file (or PM me a copy). Thanks.

barkbarkuk’s picture

StatusFileSize
new3.46 KB

Hopefully this isn't confusing the issue, but I'm having almost identical problems.

Where majortom's generated URLS were 'www.example.com/v/GalleryName' however, I have an additional trailing '/', i.e. 'www.example.com/v/GalleryName/'.
If I drop the trailing '/' from the URL after clicking the album link, then the album displays as expected and any pictures selected within the album display without error.

For reference I've attached my .htaccess file... hope this is extra info and not a red herring for majortom's problem.

barkbarkuk’s picture

Just upgraded to the DRUPAL-5--2 branch of the gallery.module and it's actually working for me now (as well as being a rather nice upgrade, thx).

sewpafly’s picture

I'm seeing the same problem on the 5.x-2.x branch. It appears that my .htaccess file is not being updated with the correct settings from gallery. Since it was a different version I filled out a report here and then marked it as a duplicate once I found this thread.

bluesquare’s picture

I was experiencing this and through some careful checking of settings I was able to get the module to behave.

The main issue was getting the changes made by Gallery added to the embedded (drupal) .htaccess file and the .htaccess file in the gallery2 directory. This requires (temporarily) setting permissions on both of these files to 777 ('chmod 777 .htaccess' from the command line in each directory) so that you are sure that gallery2 is able to make changes to both the files. Make sure you change your permissions back to 755 once you are done.

NB// It is a REALLY good idea to backup your drupal .htaccess file at this point. While I was fiddling to get this right I brought Drupal and G2 to their knees a few times. It is very reassuring to have a known working .htaccess file to copy over a broken one to get back to the beginning again.

It is crucial that you make changes to the settings for the "embedded URL rewrite settings" which are not the same as what you can get to via the Gallery 2 admin menus.

Go to the admin menu on your drupal (5) site. Select 'Site Configuration' -> 'Gallery Settings' -> 'Links to Gallery2 Site Admin sections most relevant to Drupal (advanced)' -> 'Embedded URL Rewrite settings '

You will then get an embedded version of the Gallery admin interface. Click on the "Setup" tab if it's not already selected. You should then notice an "Embedded Setup" section which does not appear when you enter the admin menu via the gallery application.

Set "Absolute path to the folder of your embedded .htaccess:" to point to the directory that contains your drupal .htaccess file (in your case /usr/share/www/Drupal/).

Set "Please enter the Url to your environment." to point to the site root for Drupal. It automatically fills in the domain for you so just enter '/' here.

For good measure click on the "Test" tab to see if all is good.

Good Luck!

Blue Square.

PS. Make sure you reload and/or clear browser cache when testing these settings. You need to make sure you really are looking at the working version of these pages before assuming what you've done has worked.

sewpafly’s picture

Brilliant. Excellent description, walked me right through it.

1kenthomas’s picture

Version: 5.x-1.x-dev » 5.x-2.x-dev
Priority: Normal » Minor

The above also worked for me, with some caveats.

At least under multisite, the absolute path directory must be pointed to the drupal .htaccess file, and the URL to the site in question ( / works).

Looks like this issue could be closed.

~kwt

profix898’s picture

Category: bug » task
Priority: Minor » Normal

Looks like this issue could be closed.

No, definitely not! We want to change the code and update the documentation, so that everybody can get the required information from the module and its docs. Thanks a lot for your detailed description, bluesquare! What is mentioned as 'Embedded Setup' section in G2 should (almost) be the same as the 'URLRewrite (Step 4)' during install of the module v2. What means we need to update the autodetect code to be more precise (e.g. detect single-/multiside install and detect write-protected .htaccess files, etc.) and update the description of the rewrite step to reflect all this.

jakesheridan’s picture

I tried this fix but when I get to "Embedded URL Rewrite Settings" I get the following error page:

----

Security Violation
The action you attempted is not permitted.

Back to the Gallery

Error Detail -
Error (ERROR_PERMISSION_DENIED)
in modules/core/classes/GalleryView.class at line 168 (GalleryCoreApi::error)
in modules/core/SiteAdmin.inc at line 196 (GalleryView::loadView)
in modules/core/classes/GalleryView.class at line 300 (SiteAdminView::loadTemplate)
in main.php at line 441 (GalleryView::doLoadTemplate)
in main.php at line 94
in modules/core/classes/GalleryEmbed.class at line 179
in /home/phoenix/public_html/phoenixfire/modules/gallery2/gallery.module at line 215 (GalleryEmbed::handleRequest)
in ??? at line 0
in /home/phoenix/public_html/phoenixfire/includes/menu.inc at line 418
in /home/phoenix/public_html/phoenixfire/index.php at line 15
System Information
Gallery version 2.2.2
PHP version 5.2.1 apache
Webserver Apache/1.3.37 (Unix) PHP/5.2.1 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a
Database mysqli 5.0.27-standard
Toolkits SquareThumb, ImageMagick, Thumbnail, Gd
Operating system Linux kobol.liquidweb.com 2.6.9-42.0.10.ELsmp #1 SMP Tue Feb 27 09:40:21 EST 2007 x86_64
Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 2.0.50727)

----

I've CHMOD'ed the .htaccess files but no luck...still same message.

1kenthomas’s picture

Version: 5.x-2.x-dev » 5.x-1.0
Priority: Normal » Critical

No, definitely not! We want to change the code and update the documentation, so that everybody can get the required information from the module and its docs.

Oops on that one. As well, multisite does not seem to work with Apache-based URL rewrites: the g2 code seems to over-write any previous rewrite rules when invoked from either embedded interface, leaving rewrites working on only a single site.

The reg expressions themselves seem to overlap namespaces, and don't work simultaneously, but I tried only cursorily.

PHP seems to work but the results are quite a bit uglier.

1kenthomas’s picture

Category: task » bug
Priority: Critical » Minor
StatusFileSize
new5.15 KB

To clarify the previous (late-night) statement, in a multisite configuration, submitting either of:

-- the Gallery2 settings interface in Drupal, or
-- the embedded config in G2

will cause the .htaccess folder to be overwritten with rewrite rules for the current site (thus eliminating the rules for the previous site).

Unlike as reported, copying the correct block from the previous version into the new .htaccess will allow two sites to run in 'proper' multisite mode, suggesting that a work-around for the error is possible (if not already done in the new dev version).

.htaccess attached in case useful.

ow1n’s picture

I get the same error as Jakesheridan, with this environment:

Gallery version 2.2.1
PHP version 4.3.10-16 apache2handler
Webserver Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-16 mod_ssl/2.0.54 OpenSSL/0.9.7e
Database mysqlt 4.1.11-Debian_4sarge7-log
Toolkits NetPBM, Gd
Operating system Linux pe99 2.6.8-2-386 #1 Tue Aug 16 12:46:35 UTC 2005 i686
Browser Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6

andydev’s picture

Same problem here.
Subscribing

profix898’s picture

Category: bug » task
Priority: Minor » Normal

Seems we are having two issues here:

  1. A better description of how to setup url rewrite (single-site) is needed
  2. URL Rewrite for multisite Drupal installations is not supported, because all Drupal sites share the same .htaccess files and G2 overrides the rewrite rules of the first site updating the second site ... But actually I dont see how we can workaround this limitation in the Drupal module. Its not supported by G2 in the first place. What means you can only get this to work by manually merging the rules into the one Drupal .htaccess.

Any other ideas? Does anyone volunteer to write a wiki page (on codex.gallery2.org) for this?

andydev’s picture

Isn't it possible for the module to autodetect the configuration?
And if it cannot change the .htaccess file, to advise to make it writable so the changes can take place?

profix898’s picture

Detecting a multisite installation is the easy part ... You would need Drupal (actually the gallery.module) to parse .htaccess rules from G2 store them at a save place. Whenever .htaccess is modified you would re-parse the file, compare the rules, merge them if required and override .htaccess with the combined ruleset. Thats a lot of logic to implement and even then you couldnt guarantee this to work correctly in all cases.

I'm not convinced that such a complex solution is desirable ... IMO its much easier to write a tutorial telling people with advanced (multisite) installations how to set this up manually. If anyone else wants to write the parser/merger stuff, I'd be happy to review and think about adding this to the module.

kiz_0987’s picture

There has been a plan suggested by the gallery devs to alter the URL Rewrite to act more in the way that Drupal does (pass all the info to gallery and let it do the redirection, instead of everything in the .htaccess file). This seems to me to be a much more applicable method -- maybe vote for it if it is not yet on the official list.

thumb’s picture

Title: Embeded Gallery 2.2.1 URL Rewrite Fails with Drupal 5.1 Clean URLs enabled. » Volunteering to document rewrite configuration
Component: Code » Documentation
Assigned: Unassigned » thumb

Since I'm hacking my through this for my sites, I'll volunteer to write the Gallery codex page. I'll compile an outline for comments and post it later today or tomorrow.

profix898’s picture

Great :) Thanks in advance!

profix898’s picture

I have started a new issue to coordinate documentation tasks at http://drupal.org/node/187157. I will also add a notice to the project page hoping for some people to jump on and help.

profix898’s picture

Version: 5.x-1.0 » 5.x-2.x-dev
timotool’s picture

bluesquare's instruction works. Thank you very much. Oh my God... thank you, thank you.

hendryman’s picture

Title: Volunteering to document rewrite configuration » THANK YOU!

bluesquare: great, your info really saved my day. thank you very much!

hendryman’s picture

profix898’s picture

Title: THANK YOU! » Volunteering to document rewrite configuration
1kenthomas’s picture

Status: Active » Closed (won't fix)

Closing; // outdated. Reopen if important to anyone.