Hi all,
I have tried for long time but unfortunately I didn't get any success.
I have Drupal installed in a sub folder ('cms') and after many tries I found out that if I set the $base_url variable, then Boost does not serve cached pages.
If I omit the $base_url variable, pages are served cached by Boost, but internal links will show the subdirectory path in the url.
These are the settings:
1) .htaccess in the root of the server:
RewriteEngine on
RewriteRule ^$ /cms/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /cms/$1 [L]
2) .htaccess in the subfolder where Drupal is installed:
# NORMAL
RewriteCond /var/www/vhosts/domain.com/httpdocs/cms/cache/normal/www.domain.com%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* cache/normal/www.domain.com%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]
3) settings.php
$base_url = 'http://www.domain.com';
As I said, if $base_url is set, then Boost does not serve cached pages, but internal links are written as they are supposed to be (if I go to http://www.domain.com/admin I am correctly redirected to the admin interface of Drupal), but if I comment the $base_url variable, cached pages are served by Boost, but internal links will show up the 'cms' subdirectory.
Any idea why this is happening?
Thanks a lot.
Comments
Comment #1
Aibu commentedTried also with dev but no luck so far.
Anyone has Boost running in a Drupal installed on a subfolder? Have you experienced the same issue?
Thanks a lot.
Comment #2
jho1086 commentedsubscribing
Comment #4
anavarreSubscribing
Comment #5
cantidubi commentedSubscribing
Comment #6
tfo commented+1
Comment #7
newtonpage commentedsubscribing
Comment #8
justcaldwellSame issue. Subscribing.
Comment #9
justcaldwellWhen the $base_url is set as described above, Boost will write cache files to a directory path that does not include 'cms'. But the .htaccess rewrite rules generated by Boost continue 'looking' for files at a path that includes 'cms'. For example - given a request for http://www.domain.com/foo/bar
Boost writes the cache file at
cache/normal/www.domain.com/foo/bar/_.html
But the .htaccess RewriteCond still 'looks' for it at
cache/normal/www.domain.com/cms/foo/bar/_.html
Details
By setting the $base_url, you've told Drupal/Boost to stop using the cms directory. The Boost .htaccess rules, however, rely on %{REQUEST_URI} provided by the server; which, in this scenario, still contains 'cms' in the path.
Given the same request http://www.domain.com/foo/bar - after it's rewritten by the rule at the root level, %{REQUEST_URI} becomes /cms/foo/bar/.
This is checking for existence of the file in the wrong directory.
One solution
Modify the .htaccess rewrites to use a portion of REQUEST_URI (minus '/cms').
It seems to me that this – or some flavor of it – should work, but I can't confirm as it generates 500 errors in my environment. I think (hope) I've got a server config issue.Got it working with the modified rewrites above.Comment #10
justcaldwellTo follow up: Turns out I did have some config issues. Once those got cleared up, the solution above worked for me.
Comment #11
ecalcerrada commentedHi justcaldwell,
for the first time I've understood what the problem I had with Boost was. In effect I've also Drupal installed in a subdirectory (in my case "drupal", instead of "cms"), and $base_url set, but I've tried to apply your solution and that doesn't work for me. In Status Report there was an error message indicating that ".htaccess file does not contain or match the boost specific rewrite rules, or the rewrite rules have changed".
I had configured .htacces like this (I'm using also gzip compression, so I added that section):
Do you know what is wrong with it? I wonder if I should change %2 for another value, or maybe don't repeat the same %2 value both in # GZIP and in # NORMAL sections. (Really I don't know what %2 means or where it comes from...)
Any idea?
Thanks a lot!
Comment #12
kirtimansharma commentedsubscribe
Comment #13
unc0nnected commentedAbove solution doesn't work for me unfortunately
+subscribe
Comment #14
reswild commented@ecalcerrada: "%2" is a backreference to the second grouped part (that is, the stuff in the parentheses) of the pattern from the last matched RewriteCond, so it is no problem with repeating it several times.
But if you are going to mess around with htaccess rewrite rules anyway, then I think a better solution would be to not rely on $base_url in the first place, but instead set up a rewrite rule to point your domain to the right folder.
Comment #15
jesse20142014 commentedSame issue. Subscribing.
Comment #16
borrico1965 commentedHi,
Have you tried implementing solution made by dagomar found here, https://www.drupal.org/node/1459690#comment-7261264?
It's a comment in a post entitled, Boost 7.x: installation instructions.
It worked for me, it might help solve your problem too.
Comment #17
avpadernoComment #18
avpadernoI am closing this issue, as Drupal 6 is no longer supported.