Drupal and Gallery URL Rewrite issue

bugeye

Joined: 2005-07-06
Posts: 63
Posted: Sun, 2008-01-13 10:39

I am trying to enable Clean URL's on my Drupal and Gallery integration. Drupal successfully enables Clean URL's but if I go to the Gallery modules admin page (/admin/settings/gallery/) every sub page (/admin/settings/gallery/*') falsely directs to 'http://example.com/http:/main.php'. I'm assuming at this stage that the Gallery module has just enabled URL Rewrite in the Gallery and my problem is stemming from an misconfiguration there, but when I check in the Gallery, URL Rewrite is disabled.

I have a .htaccess file in Drupal's root and in Gallery's root. Am I suppose to have a .htaccess in Gallery? I'm not sure what the correct setup looks like. Could someone who has Clean URL's working please provide me with their .htaccess file(s)/configuration details?

Thank you for any advice
Bugeye

Site: http://sourdough.com.au

Drupal is installed in the root /
With Gallery in recommended location /gallery2/

Here are my .htaccess files just in case
Drupal

# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)
<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} !/$
    RewriteRule .   -   [L]

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

# END Url Rewrite section

#
# 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\.sourdough\.com\.au$ [NC]
  RewriteRule ^(.*)$ http://sourdough.com.au/$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 $

Gallery

# 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/sitemap(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
    RewriteRule .   /gallery2/main.php?g2_view=sitemap.Sitemap   [QSA,L]
    RewriteCond %{THE_REQUEST} /gallery2/admin/(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
    RewriteRule .   /gallery2/main.php?g2_view=core.SiteAdmin   [QSA,L]
    RewriteCond %{THE_REQUEST} /gallery2/gallery/d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
    RewriteRule .   /gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3   [QSA,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

Gallery version = 2.2.3 core 1.2.0.5
PHP version = 4.4.4 cgi
Webserver = Apache/1.3.37 (Unix) 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 PHP-CGI/0.1b
Database = mysql 4.1.22-standard, lock.system=flock
Toolkits = ArchiveUpload, ImageMagick, Gd
Acceleration = none, none
Operating system = Linux gator47.hostgator.com 2.6.22_hg_grsec_pax #45 SMP Thu Dec 6 03:29:19 CST 2007 i686
Default theme = matrix
gettext = enabled
Locale = en_US
Browser = Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Rows in GalleryAccessMap table = 375
Rows in GalleryAccessSubscriberMap table = 2366
Rows in GalleryUser table = 372
Rows in GalleryItem table = 2365
Rows in GalleryAlbumItem table = 93
Rows in GalleryCacheMap table = 0

 
profix898

Joined: 2005-11-08
Posts: 135
Posted: Sun, 2008-01-13 22:10

Not sure you have URL Rewrite enabled in G2 or at least you had it enabled at a time, but there definitely are rewrite rules for G2 at the top of your Drupal .htaccess file (everything between "# BEGIN Url Rewrite section" and "# END Url Rewrite section").

For your setup: Make sure that URL Rewrite is enabled and running in G2 standalone mode (configures the .htaccess file in your G2 folder). After that you can try to reconfigure your embedded G2 in Drupal. Your 'Show Item' rule should be set to 'gallery/v/%path%' (or you need the workaround from the codex).

 
Jeremy Toaster

Joined: 2008-03-05
Posts: 14
Posted: Wed, 2008-03-05 16:34

I think this is what both of us cannot figure out, is how to get URL Rewrite to work in G2 standalone, everything points to saying that it IS working and tested fine, but then it doesn't actually do it.

Could you maybe post your .htaccess file of a properly working G2 URL Rewrite site?

This is what my G2 .htaccess file looks like right now.

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

RewriteBase /megalithrecords/www/gallery2/

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

RewriteCond %{THE_REQUEST} /megalithrecords/www/gallery2/admin/(\?.|\ .)
RewriteCond %{REQUEST_URI} !/megalithrecords/www/gallery2/main\.php$
RewriteRule . /megalithrecords/www/gallery2/main.php?g2_view=core.SiteAdmin [QSA,L]
RewriteCond %{THE_REQUEST} /megalithrecords/www/gallery2/f/([^?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/megalithrecords/www/gallery2/main\.php$
RewriteRule . /megalithrecords/www/gallery2/main.php?g2_controller=permalinks.Redirect&g2_filename=%1 [QSA,L]
</IfModule>

# END Url Rewrite section

 
Jeremy Toaster

Joined: 2008-03-05
Posts: 14
Posted: Wed, 2008-03-05 16:37

What should I have in the "Approved referers"

The first line is
locahost
And it is grey'd out, so I cannot change it.
What should I have in the next 3 lines?