Gallery2 integration works brillantly with Drupal 5.7 but not SEF URL

duvien - March 6, 2008 - 18:35
Project:Gallery
Version:5.x-2.2
Component:Installation / Configuration
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

The installation and configuration of Gallery2 integration with Drupal works exactly as expected. However, i'm having a problem trying to run it with SEF URL turned on. It only allows me to access the album but when clicking on it to view images inside the album it just directs me back to the image album. This also happens with images in the block.

I followed the steps here: http://codex.gallery2.org/Integration:Drupal:Troubleshooting#Error_.28ER... and here: http://codex.gallery2.org/Integration:Drupal:Quick_Start but still failed though the embedded Gallery still functions fine, just not the SEF URL.

Has anyone resolved this or is this a known bug? I had to turn off SEF URL on Gallery2 to get everything working again.

Thanks,

#1

duvien - March 11, 2008 - 16:35

is there anyone who had experienced this issue managed to fix it? and what did you do to resolve this issue. Also this is giving problems when trying to save my gallery configs using gallery embed in Drupal. Thank you,

#2

lvthunder - March 11, 2008 - 20:40

Do either of you have a link so I can see what it's doing? Make sure you have the URL Rewrite module turned on the G2 and Clean URL turned on in Drupal and let me take a look.

#3

duvien - March 11, 2008 - 21:24

Here's the link: www.duvien.com/gallery

I've turned SEF back on for now so you can see what i mean.

I used both:

gallery/%path%

gallery/v/%path%

for the path for image item and disable all the others. But still failed.

thanks,

P.S. it was me posting up twice, sorry.

#4

lvthunder - March 11, 2008 - 21:26

Can you post your .htaccess file?

#5

duvien - March 11, 2008 - 21:37

This is the drupal one (in root directory):

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "(\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
  Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On
  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600
  # Do not cache dynamically generated pages.
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on


  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
   RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
   RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal

  # Rewrite old-style URLs of the form 'node.php?id=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
  #RewriteRule node.php index.php?q=node/view/%1 [L]

  # Rewrite old-style URLs of the form 'module.php?mod=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
  #RewriteRule module.php index.php?q=%1 [L]

  # Rewrite current-style URLs of the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.81.2.2 2007/05/21 01:34:59 drumm Exp $

AddHandler application/x-httpd-php5 .php

And this is the gallery2 (which is installed to a driectory named gallery2):

# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /gallery2/

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
    RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
    RewriteRule .   -   [L]

    RewriteCond %{THE_REQUEST} /gallery2/gallery/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
    RewriteRule .   /gallery2/main.php?g2_path=%1   [QSA,L]
</IfModule>

# END Url Rewrite section

thanks,

#6

lvthunder - March 11, 2008 - 21:47

It's a problem with the Drupal .htaccess file. It's not including the stuff from Gallery. Make sure it is writable and visit the Install page of the gallery module. You should see stuff that looks like the G2 htaccess file at the top of the Drupal one.

#7

duvien - March 11, 2008 - 22:01

I've just resetted the gallery install and when thru the process. This time with the drupal .htaccess being writable (as you said). It completed successfully but nothing got written to the .htaccess file.

What code must i put in the drupal .htaccess file for this to work?

thank you,

#8

lvthunder - March 11, 2008 - 22:57

This is what mine says. I'm not sure if it will be the same since I have a multisite going on. just copy and paste this to the top and try.

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
    RewriteCond %{REQUEST_URI} !/index\.php$
    RewriteRule .   -   [L]

    RewriteCond %{THE_REQUEST} /d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/index\.php$
    RewriteRule .   /gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3   [QSA,L]
    RewriteCond %{THE_REQUEST} /key/([^?/]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/index\.php$
    RewriteRule .   /index.php?q=gallery&g2_view=keyalbum.KeywordAlbum&g2_keyword=%1   [QSA,L]
    RewriteCond %{THE_REQUEST} /v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/index\.php$
    RewriteRule .   /index.php?q=gallery&g2_path=%1   [QSA,L]
</IfModule>

#9

duvien - March 11, 2008 - 23:09

You're a genius!

Many thanks, that worked wonders :)

#10

lvthunder - March 12, 2008 - 03:44
Status:active» closed

I don't know about the genius part, but I'm glad you got it working.

 
 

Drupal is a registered trademark of Dries Buytaert.