I spend hours to embed my Gallery2 correct in Drupal.
I want to use my Gallery2 embedded in Drupal(6) and I want to use my Gallery2 also . To get this don I needed to wire the .htaccess files manually.
IMPORTANT: Do not use the dir gallery for your stand alone Gallery2 installation. This conflicts with Drupal gallery.module.
Gallery2 Stand Alone
I named my Gallery2 directory /path/to/gallery2
When I point my browser to http://www.DOMAINNAMEN.com/gallery2 I get my Stand Alone Gallery2 installation. To make this work is't important to:
- add /gallery2/ to each RewriteCond in the .htaccess file from Gallery2. This is de .htaccess file in your gallery2 directory.
- Add a Alias in the Apache virtual host setup for this domain.
So in the file /etc/apache/site-available/www.DOMAINNAME.com I added a line line thisAlias /gallery2 /path/to/www.DOMAINNAME.com/gallery2
Normally all request for the domain ends up in the root Drupal directory. (/path/to/drupal). All request are handled by Drupal. So Gallery2 doesn't get the change to do anything for some stand alone work. To hack that problem all request to www.DOMAINAME.com/gallery2 must be re routed to the gallery2 directory on the file system (/path/to/www.DOMAINNAME.com/gallery2. The Alias line provides that.
.htaccess files
This is my .htaccess file in /path/to/drupal/. I only show the relevant section of the .htaccess file. There are more lines in it but they are not important for Galley2 embedding
/path/to/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 %{THE_REQUEST} /gallery/v/updates(\?.|\ .)
RewriteCond %{REQUEST_URI} !/index\.php$
RewriteRule . /index.php?q=gallery&g2_view=dynamicalbum.UpdatesAlbum [QSA,L]
RewriteCond %{THE_REQUEST} /gallery/v/popular(\?.|\ .)
RewriteCond %{REQUEST_URI} !/index\.php$
RewriteRule . /index.php?q=gallery&g2_view=dynamicalbum.PopularAlbum [QSA,L]
RewriteCond %{THE_REQUEST} /gallery/v/sitemap(\?.|\ .)
RewriteCond %{REQUEST_URI} !/index\.php$
RewriteRule . /index.php?q=gallery&g2_view=sitemap.Sitemap [QSA,L]
RewriteCond %{THE_REQUEST} /gallery/v/random(\?.|\ .)
RewriteCond %{REQUEST_URI} !/index\.php$
RewriteRule . /index.php?q=gallery&g2_view=dynamicalbum.RandomAlbum [QSA,L]
RewriteCond %{THE_REQUEST} /gallery/v/d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/index\.php$
RewriteRule . /gallery/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3 [QSA,L]
RewriteCond %{THE_REQUEST} /gallery/v/([^?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/index\.php$
#RewriteCond %{REQUEST_URI} !/gallery2/gallery/v/militairedienst/
RewriteRule . /index.php?q=gallery&g2_path=%1 [QSA,L]
</IfModule>
# END Url Rewrite sectionThis is my .htaccess file in /path/to/www.DOMAINNAME.com/gallery2/
/path/to/www.DOMAINNAME.com/gallery2/.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} /gallery2/gallery\_remote2\.php
RewriteCond %{REQUEST_URI} !/gallery2/gallery/main\.php$
RewriteRule . - [L]
RewriteCond %{THE_REQUEST} /gallery2/gallery/v/updates(\?.|\ .)
RewriteCond %{REQUEST_URI} !/index\.php$
RewriteRule . /gallery2/main.php?q=gallery&g2_view=dynamicalbum.UpdatesAlbum [QSA,L]
RewriteCond %{THE_REQUEST} /gallery2/gallery/v/popular(\?.|\ .)
RewriteCond %{REQUEST_URI} !/index\.php$
RewriteRule . /gallery2/main.php?q=gallery&g2_view=dynamicalbum.PopularAlbum [QSA,L]
RewriteCond %{THE_REQUEST} /gallery2/gallery/v/random(\?.|\ .)
RewriteCond %{REQUEST_URI} !/index\.php$
RewriteRule . /gallery2/main.php?q=gallery&g2_view=dynamicalbum.RandomAlbum [QSA,L]
RewriteCond %{THE_REQUEST} /gallery2/gallery/v/sitemap(\?.|\ .)
RewriteCond %{REQUEST_URI} !/index\.php$
RewriteRule . /gallery2/main.php?q=gallery&g2_view=sitemap.Sitemap [QSA,L]
RewriteCond %{THE_REQUEST} /gallery2/gallery/v/([^?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/gallery/main\.php$
RewriteRule . /gallery2/main.php?g2_path=%1 [QSA,L]
</IfModule>
# END Url Rewrite section