1

I've inherited a large Drupal web site and now we're updating from Drupal 6 to Drupal 7. I cannot enable CleanURL for more than one subdirectory at a time! I think I've read just about every article on CleanURLs there is, and possibly my situation is unique, or maybe I'm going about things wrong?

We have a couple versions live on our web site using different subdirectories and databases. There are two sites total on one domain, each with a Drupal 6 "live" copy and a Drupal 7 "test" version on the host. They are organized as follows:

siteA_D6 -> example.com/
siteB_D6 -> example.com/siteB_D6
siteA_D7 -> example.com/siteA_D7
siteB_D7 -> example.com/siteB_D7

We want the subdirectories to work as I've listed them above, but eventually we will retire the D6 versions and redirect D7 to example.com/ and example.com/siteB

Currently, all 4 sites are accessible, but, CleanURLs only work on siteA_D6 (or example.com). Ideally we want to have CleanURL enabled on all of them, so that

http://example.com/test/arguments and
http://example.com/siteA_D7/test/arguments 

resolve to the "same" page in different versions, and we never see ?q=test/arguments in the address bar

Our shared-server web host considers this issue "beyond ordinary technical support"... can't blame them, I've been banging my head up against this wall for days now. I'd really appreciate a solution or just some pointers.

(.htaccess copied below)

Options All -Indexes

ErrorDocument 404 "This page was not found on this server"

RewriteEngine On
RewriteBase /

Options +FollowSymLinks

# Closing the back door
RewriteCond %{QUERY_STRING} (ch|php_code)=(.*)
RewriteRule (.*) ##pretend url here, it won't let me post "too many links"## [L]

# Block pharmaceutical hotlink chicanery
RewriteCond %{HTTP_REFERER} ^http://.*pharmacy [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ - [F]

# stuff to let through
# I have been commenting these out when testing new rules
RewriteCond %{REQUEST_URI} "/siteB_D6/" [OR]
RewriteCond %{REQUEST_URI} "/siteB_D7/" [OR]
RewriteCond %{REQUEST_URI} "/siteA_D7/"
RewriteRule (.*) $1 [L]

#this one redirects all requests from domain to new folder
RewriteCond %{HTTP_HOST} ^.*example.org$
RewriteCond %{REQUEST_URI}  !^siteA_D6.*
RewriteRule ^(.*)$ "site_A_D6/$1" [L]

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/username
<Files php.ini>
order allow,deny
deny from all
</Files>
</IfModule>    
2

It seems that your .htaccess is custom made, first of all you should have a look at the one Drupal provides as you're missing some criticals rules like

<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
  Order allow,deny
</FilesMatch>

Regarding your problem, I think you should change the RewriteBase condition like this:

RewriteBase /siteB_D6

for each of you subsite (make it matches the subdirectory where it's located).

  • Thanks so much for your reply, Tostinni! My problem was a mix of not using RewriteBase properly, and missing configuration from the default file. Once I went in that direction it was pretty easy to work out. I'm not sure why our site was configured the way it was, but it's sorted out now. – user17294 May 10 '13 at 14:09
  • Glad I was helpful. – tostinni May 10 '13 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.