NOTE that no static files will be created when you are logged into the backend in the same browser session as you are doing the frontend requests with (unless you Ctrl Shift Reload).
By default all pages are marked to be cached. The same logic TYPO3 follows to create page cache is used to create static pages. So you should not have to touch the checkbox in the page properties.
If you want to make it very explicit that you don't want a page to be cached, uncheck the 'Cache page as static file' checkbox in the page properties of that page. You want to do this if your page uses 'timing' features or typoscript conditions that to not work properly when caching to static files.
Illustration 1: Cache page as static html checkbox, enabled by default.
The extension has several global configuration options that are accessible through the extension manager.
Clear cache for all domains in tree
Here you can decide what to do when clearing the frontend cache. By default all static html files will be deleted. Usually this is fine. Most installations of TYPO3 serve a single domain. If multiple domains are served from the same TYPO3 tree you might want to leave the cache for the other domains intact. If you uncheck the 'clearCacheForAllDomains' checkbox, only the html files are removed that are in the same domain as which you are logged into the backend.
Send cache control header
If your apache has mod_expires loaded, you can use it to make nc_staticfilecache send Cache-Control headers together with the statically served files. This is accomplished by writing a .htaccess file for every statically cached file.
Show generation timestamp signature
When checking this box, a signature will be added to each generated static html file. This is useful for debugging purposes. This allows you to peak at the source of a page and see if the signature is present. If it is, then the file came from the static html cache.
Timestamp format
This allows you to format the time according to your own locale. Please see the php manual for the function 'strftime'.
Log debug information to cc_devlog
If enabled, logging info will be written to cc_devlog. So make sure you have this installed if you have this option checked.
Illustration 2: Global configuration options.
You have to add a chunk of mod_rewrite configuration to your htaccess file. There is a example htaccess file in the doc dir of nc_staticfilecache, it is called: _.htaccess.
#------------------------------------------------------------------------------
# beginning of static file cache ruleset
# Don't pull *.xml, *.css etc. from the cache
RewriteCond %{REQUEST_FILENAME} !^.*\.xml$RewriteCond %{REQUEST_FILENAME} !^.*\.css$# Check for Ctrl Shift reload
RewriteCond %{HTTP:Pragma} !no-cacheRewriteCond %{HTTP:Cache-Control} !no-cache# Don't cache HTTPS traffic by default. You may choose to comment out this
# option if your site runs fully on https. If your site runs mixed, you will
# not want https traffic to be cached in the same typo3temp folder where it can
# be requested over http.
# Enable this if you use a mixed setup.
#RewriteCond %{HTTPS} off# NO backend user is logged in. Please note that the be_typo_user expires at the
# end of the browser session. So, although you have already logged out of the
# backend, you will still have to either restart your browser or remove the
# cookie manually for this rule to work.
RewriteCond %{HTTP_COOKIE} !be_typo_user [NC]# NO frontend user is logged in. Logged in frontend users may see different
# information than anonymous users. But the anonymous version is cached. So
# don't show the anonymous version to logged in frontend users.
RewriteCond %{HTTP_COOKIE} !nc_staticfilecache [NC]# We only redirect GET requests
RewriteCond %{REQUEST_METHOD} GET# We only redirect URI's without query strings
RewriteCond %{QUERY_STRING} ^$# We only redirect if a cache file actually exists
# Uncomment the following two lines if you use realurl:
#RewriteCond %{DOCUMENT_ROOT}/typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}/%{REQUEST_URI}index.html -f#RewriteRule .* typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}/%{REQUEST_URI} [L]# Uncomment the following two lines if you use simulateStaticDocuments:
#RewriteCond %{DOCUMENT_ROOT}/typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}/%{REQUEST_URI}/index.html -f#RewriteRule .* typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}/%{REQUEST_URI}/index.html [L]# end of static file cache ruleset
#------------------------------------------------------------------------------
The static file cache configuration should be inserted in the .htaccess file just before these lines:
RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-lRewriteRule .* index.php [L]
If the TYPO3 Installation isn“t in your root dir *say your site lives in http://some.domain.com/t3site/), then you have to add the missing part to the configuration snippet. The last two lines of the ruleset would then change into something like this:
RewriteCond %{DOCUMENT_ROOT}/t3site/typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}/%{REQUEST_URI}index.html -fRewriteRule .* t3site/typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}/%{REQUEST_URI} [L]You are of course free to make the rules as complex as you like.
There might be some files you never want to pull from cache even if they are indexed. For example you might have some custom realurl rules that make your RSS feed accessible as rss.xml. You can skip rewriting to static file with the following condition:
RewriteCond %{REQUEST_FILENAME} !^.*\.xml$