Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
lvthunder CreditAttribution: lvthunder commentedWhat 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?
Comment #2
scottgifford CreditAttribution: scottgifford commentedI 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.
Comment #3
lvthunder CreditAttribution: lvthunder commentedWell 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.
Comment #4
scottgifford CreditAttribution: scottgifford commentedYes, I fixed the issue. Some of our multisites are different domains, others are different subdirectories.
Comment #5
scottgifford CreditAttribution: scottgifford commentedI 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.
Comment #6
alforddm CreditAttribution: alforddm commentedYou 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.