I have a multisite Drupal configuration, with all sites sharing the same Drupal root. When we activate Gallery on one of those sites, the rewrite rules it adds to the .htaccess in the Drupal root breaks other sites. Here are the rules it is adding:

# 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} /d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/index\.php$
    RewriteRule .   /drupal/sites/site.specific.dir/gallery2/main.php?g2_view=core.Down
loadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3   [QSA,L]
    RewriteCond %{THE_REQUEST} /gallery/v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/index\.php$
    RewriteRule .   /index.php?q=gallery&g2_path=%1   [QSA,L]
</IfModule>

# END Url Rewrite section

Any suggestions for working around this?

Comments

lvthunder’s picture

What do you mean when you say it breaks others sites? I have the same setup as you but I'm not having any problems. The only difference is that I use G2 on both sites. Maybe a link to a couple sites would help?

scottgifford’s picture

I have fixed the sites by adjusting the directory arrangement, but basically any page besides the front page would not load, it gave a 404 error. I could see from the logs the request was being rewritten incorrectly.

Part of the problem may have been that the broken site ran in a subdirectory of the domain, that is, http://www.suspectclass.com/sgifford instead of just http://www.suspectclass.com/ ; looking at the rewrite rule, that may have confused it.

lvthunder’s picture

Well now http://www.suspectclass.com redirects to http://www.suspectclass.com/sgifford. Did you fix the issue? My multisites are a different subdomains instead of just folders.

scottgifford’s picture

Yes, I fixed the issue. Some of our multisites are different domains, others are different subdirectories.

scottgifford’s picture

I should mention that the reason I'm reporting the problem even though it's fixed is that when the Gallery module is re-installed or installed on a new site, it makes the same .htaccess changes and breaks our other sites again.

alforddm’s picture

You should skip the .htaccess configuration part of the install and add the changes manually to the .htaccess file for the new site. Otherwise, the module tries to overwrite the current .htaccess setup.