1

I'm using Stash's static cache on a site and have wrapped my Freeform tags in {stash:nocache} but whenever I try to submit a form, I get taken to a page like /?ACT=XX with the error No input file specified.

stash_file_sync is set to false and I'm using the .htaccess rules printed out in the CP:

#################################################################################
# START MUSTASH STATIC CACHE RULES 

# -------------------------------------------------------------------------------
# default_site
# -------------------------------------------------------------------------------

# Exclude image files
RewriteCond $1 !\.(gif|jpe?g|png|ico)$ [NC]

# We only want GET requests
RewriteCond %{REQUEST_METHOD} GET

# Exclude CSS/ACT EE URLs and 'preview'
RewriteCond %{QUERY_STRING} !^(css|ACT|URL|preview)

# Uncomment this if you want to disable static caching for logged-in users
#RewriteCond %{HTTP_COOKIE} !exp_sessionid [NC]

# Remove index.php from conditions
RewriteCond $1 ^(index.php/)*(.*)(/*)$

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

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

# END MUSTASH STATIC CACHE RULES
#################################################################################

# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

</IfModule>

Each template looks similar to:

{stash:embed
  name="home"
  file_name="views:home"
  process="static"
  context="@URI"
} 

Also, is anyone using Mustash but not getting a main menu item which gives you access to create cache-breaking rules? I can access different settings by navigation to the Mustash module or extension, but that doesn't give me a link to create cache-breaking rules.

2 Answers 2

2

Static caching

A static cached page is just plain old HTML, it doesn't pass through EE or PHP at all. You cannot therefore escape regions of the page from caching:

https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Astatic%7D

Freeform forms cannot be cached as they require a token to be generated for each user that views the form, and that is only possible if the freeform tag is parsed each time the form is viewed.

If you still want to static cache the page containing the form, I would suggest using javascript to load a form template (containing just the freeform tag) into the page, e.g with jQuery:

$("#form").load("/inc/myform");

"No input file specified"

You may need to append a '?' mark to the last rewrite rule to force query strings:

RewriteRule ^(.*)$ /index.php?/$1 [L]

https://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html#test

Test without Stash being involved at all and make sure this is working as expected before trying to cache anything.

Mustash menu

You should see a 'Mustash' menu in the main menu of the control panel. If you are using Zoo Flexible Admin then you will need to add it to the custom menu for your member group. If not, then please check to see if you have any extensions using the cp_menu_array hook and disable them one by one - it could be they are not returning the array as they should.

1
  • Mustash menu is back, it was an extension called Quickee causing the problem. With the forms, moving them to an external template and loading with AJAX only works if I update my .htaccess as you've mentioned, but if I do that, only one template gets cached and every URI returns the same template (home page).
    – Tyssen
    Aug 26, 2015 at 0:16
0

Try commenting out this line:

RewriteCond %{QUERY_STRING} !^(css|ACT|URL|preview)
1
  • That still takes me to /?ACT=XX but instead of a white page showing the error message, I get the home page instead (with some EE variables are printed out rather than parsed, e.g. path=xxxx).
    – Tyssen
    Aug 25, 2015 at 1:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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