0

I am using Stash static caching (and it is AWESOME). I'm using Stash 2.4.5, Mustash 1.0.9, and EE 2.7.2.

On my Mustash 'Static cache rewrite rules' page, in the example .htaccess code, it has the following lines:

# Check if cached index.html exists
RewriteCond /path/to/my/static_cache/1/$2/index.html (.*\.(.*))$
RewriteCond %1 -f

# Rewrite to the cached page
RewriteRule ^(index.php/*)*(.*)(/*) http://www.domain.com/static_cache/1/$2/index.%2 [L]

If I use that entire .htaccess file as is, I get weird URLs as I navigate throughout my site. The first time I visit a page (no static cache file exists yet), the URL is fine (like http://www.domain.com/about)... but the next time I visit it, I get a weird URL, like http://www.domain.com/static_cache/1/about/index.html.

Another weird thing, when I visit the home page http://www.domain.com/, if it's been cached, the url is http://www.domain.com/static_cache/1//index.html. (notice the //).

. . . HOWEVER, I found that if I remove the domain part from

RewriteRule ^(index.php/*)*(.*)(/*) http://www.domain.com/static_cache/1/$2/index.%2 [L]

to make it

RewriteRule ^(index.php/*)*(.*)(/*) /static_cache/1/$2/index.%2 [L]

then caching works and my URL's are fine...

Everything seems to be working (with the exception of the issue I noted in this question (Stash static caching not ignoring POSTs like I think it should).

But it does seem like it's indicative of some underlying issue in the way I've set things up. I assume things should work normally with the example .htaccess file provided from that Mustash page. Any ideas what I've done wrong?

1

The domain output in the rules generated by Mustash is defined by the stash_static_url config value. As you have discovered for many systems a webroot relative url should be used instead of an absolute one: https://github.com/croxton/Stash/wiki/Installing-%26-upgrading

The problem with POST requests is something I have also noticed with Low Search, which submits forms to the index page of the site. Please try the solution @Jay F posted.

| improve this answer | |
  • Thankee mucho, Mark. I'll stick with the webroot relative URL. Re: the Low Search issue, I've tried both of @jay-f 's suggestions, but still no luck. I'll keep playing with it. Thanks again, for the quick response, and your incredible EE add-ons! – Gary Reckard Jan 21 '14 at 15:36
  • Hi again Mark. I seem to have found a workaround in my .htaccess file that has it really really ignore POST requests in my server environment. Not sure why it works where the other suggestions didn't, but thought I'd share. Check that other post I linked to in my question. Cheers! – Gary Reckard Jan 21 '14 at 16:57
  • For the record, would you mind letting me know if are you using PHP as an Apache module or running it as a CGI? – Mark Croxton Jan 21 '14 at 18:04
  • Hi Mark. My phpinfo() lists "FPM/FastCGI" as the Server API. – Gary Reckard Jan 22 '14 at 3:16

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.