I posted on the Gallery2 Integration forums, but it doesn't seem that active and the problem seems to be with what's added to the .htaccess by this module.

When I enable the clean URL option in this module, my entire site breaks because of what's added to the .htaccess. I'm no longer able to get to my /admin section or any other page. It all goes to the 404 page on my domain.

Info:

Drupal 6.3
Gallery module 6.x-1.x-dev
Gallery2 version 2.3-rc1

My drupal installation is /home/motivez/w3rd.org
My drupal .htaccess is /home/motivez/w3rd.org/.htaccess
My gallery2 installation is /home/motivez/w3rd.org/g/
My gallery2 .htaccess is /home/moivez/w3rd.org/g/.htaccess

When I enabled it, it added this to the top of my Drupal .htaccess:

# 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} !/index\.php$
#    RewriteRule .   -   [L]

#    RewriteCond %{HTTP:Authorization} (.+)
#    RewriteCond %{QUERY_STRING} !g2_authorization=
#    RewriteRule .   %{REQUEST_URI}?g2_authorization=%1   [QSA]
#    RewriteCond %{THE_REQUEST} /popular(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_view=dynamicalbum.PopularAlbum   [QSA,L]
#    RewriteCond %{THE_REQUEST} /updates(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_view=dynamicalbum.UpdatesAlbum   [QSA,L]
#    RewriteCond %{THE_REQUEST} /admin/(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_view=core.SiteAdmin   [QSA,L]
#    RewriteCond %{THE_REQUEST} /random(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_view=dynamicalbum.RandomAlbum   [QSA,L]
#    RewriteCond %{THE_REQUEST} /d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /g/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]
#    RewriteCond %{THE_REQUEST} /f/([^?]+)(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_controller=permalinks.Redirect&g2_filename=%1   [QSA,L]
#    RewriteCond %{THE_REQUEST} /([^?]+)(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_view=rewrite.FileNotFound   [QSA,L]
#</IfModule>

# END Url Rewrite section

--

The rest of my Drupal .htaccess file:

#
# 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

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
  ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>

# 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 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/...)
  # uncomment and adapt the following:

RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /

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

# $Id: .htaccess,v 1.90.2.1 2008/07/08 09:33:14 goba Exp $

Comments

motivez’s picture

Component: Code / API » Installation / Configuration

I meant to put this as Installation / Configuration, but I guess I selected the wrong option. Sorry about that.

motivez’s picture

Title: Enabling Clean URL's causes every Drupal link to 404, including /admin » Clean URL's causes all Drupal links to 404, including /admin

Anyone have any ideas?

MaffooClock’s picture

I can confirm this is a valid problem.

jordanmagnuson’s picture

I confirm this as well.

Marquis’s picture

I have the same setup and problem.

(Tracking this issue)

ltam’s picture

Version: 6.x-1.x-dev » 5.x-2.2

I have a live site and a mirror set up of it lives on my local computer. I wanted to quick and dirty test it live - worked great, then reverted it back. Set it on my local box (yes, I know I did it backwards), and it 404s. Can't figure the differences.

Edit: See my next post below (2 down, #8) for my solution.

Marquis’s picture

I've have my Drupal installation in a folder called /drupal6
Once I activated url rewrite in the gallery module wizard it fails.
I've noticed from my logs that its trying to load : "drupal6 admin"... its missing the / in between. I can't even force it in probably due to a rule.

Appreciate the help.

PS. Does anyone have this running properly on D6.6 ?

ltam’s picture

I fixed mine by uncommenting line

# LoadModule rewrite_module modules/mod_rewrite.so

and also changed

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

to

AllowOverride All

in my httpd.conf

The server was already configured for rewrite, and so I didn't think about that for the settings on my local box.