Do you want to increase the significant performance of your TYPO3 website? Are you looking to convert your TYPO3 instance to static HTML files? In this article, you will learn a step-by-step guide to integrate TYPO3 super cache.
One of the great ways to boost the TYPO3 speed of your TYPO3 website is “caching”. TYPO3 core already provided a fantastic TYPO3 cache system that boost-up your TYPO3 website. But, Do you know the power of static cache? I call it “TYPO3 Super Cache”, as WordPress has a WP super cache. Fortunately, the TYPO3 community has a fantastic extension, EXT.staticfilecache.
I’ve decided to write a comprehensive TYPO3 speed and performance blog series - by taking essential points from one of my famous articles, 45+ Ultimate Ways to Speed Up Your TYPO3 Performance.
My dear TYPO3 reader, Let’s grab this opportunity to say thanks to all the TYPO3 contributors of the staticfilecache extension. Especially Tim Lochmüller (from TYPO3Blogger.net), who initiated this excellent idea. #T3Kudos for your time and efforts.
Because… TYPO3 Speed Matters
This TYPO3 blog used the TYPO3 Staticfilecache extension and got a greater rank at GTMetrix and Google page speed insights.
What/Why/How TYPO3 Super Cache?
You may be surprised; precisely what’s TYPO3 super cache? It’s just a simple technique to cache your whole website into static HTML pages. Whenever your site visitor accesses your site, the server will directly serve pages from TYPO3 cached HTML pages. It means, at every request, the server will not connect with your TYPO3 instance. Of course, it will give incredible TYPO3 speed and performance.
Team StaticFileCache gave a slogan like “It slows down the warming of the earth.” In that way, it’s an environmentally-friendly extension ;) Here is the technical explanation “Transparent StaticFileCache solution using mod_rewrite and mod_expires. Increase performance for static pages by a factor of 230!!”
Server Requirement of TYPO3 Cache
Fundamentally the idea of the EXT.staticfilecache extension to use the power of web-servers like Apache. Without dig-into-depth, Let’s see are prerequisites of TYPO3 staticfilecache extension.
TYPO3 Version Compatibility
- TYPO3 v7.x to v11.x
- TYPO3 Routing (TYPO3 core routing or EXT.realurl)
For Apache Server
- mod_rewrite
- mod_headers
- mod_expires
- Enable to handle .htaccess override.
For NgniX Server
- No need extra module
Installation of TYPO3 Static File Cache
Let’s quickly install the TYPO3 staticfilecache extension with your ways.
Did you know?
TYPO3 staticfilecache extension downloaded more than 350000+ times (and still counting)
Composer-Based TYPO3 Instance
// Run the composer installation command
composer require lochmueller/staticfilecache
Non-Composer TYPO3 Instance
Step 1. Download EXT.statifilecache from https://extensions.typo3.org/extension/staticfilecache or grab extension directly from Extensions manager in TYPO3 backend.
Step 2. Go to the Extension Manager and install this extension.
Configuration and Settings of TYPO3 Cache
You will need to perform the below two steps to configure EXT.staticfilecache TYPO3 extension ideally.
Step 1. Configure Rewriting Rules (htaccess, vhost, or NginX)
Based on your server, Go ahead to configure URL rewrites.
Using. Htaccess for Apache
Please grab the required .htaccess code from official documentation https://github.com/lochmueller/staticfilecache/blob/master/Documentation/Configuration/Htaccess.rst. Please copy and paste the configuration at the required place and make sure to read other details too.
Using NgniX Server
Here is the complete Staticfilecache routing configuration for the NgniX server https://github.com/lochmueller/staticfilecache/blob/master/Documentation/Configuration/Nginx.rst
Step 2. Test-Drive Configuration
To cross-verify your setting, the EXT.staticfilecache extension provides a nice backend module. Go to Web > StaticFileCache > Choose Configuration, Support, Documentation from top dropdown. Here you can see; Is your settings of the web server are correct or not.
Step 3. Clear Cache (TYPO3 Frontend & Backend)
Go to Admin Tools > Maintenance > Flush Cache.
Step 4. Enable TYPO3 Cache
Before start testing, make sure your TYPO3 cache is enabled using the following TypoScript configuration.
// Let’s enable the TYPO3 core cache
config.no_cache = 0
Step 5. Done! Testing and Reporting.
Hurray! Let’s have a quick test drive. Please make sure to open your website in another browser. It does not recommend to test-drive frontend in the same browser to which you’ve already logged in.
To check the status report of this extension, Go to Web > Static File Cache backend module > Choose your root page > Select List (Overview) from the top dropdown menu.
Also, you can technically check; if the TYPO3 super cache works or not? Go to your /typo3temp/tx_staticfilecache/ folder; you should see all static pages, e.g., index.html or index.gz, for your all-pages.
Backend Settings for TYPO3 Static File Cache
Let’s what are available backend settings by EXT.staticfilecache TYPO3 extension.
Page-Wise Disable/Enable TYPO3 Cache
Of course, your TYPO3 website may have some dynamic pages - You should disable StaticFileCache for all those pages, e.g., Contact forms.
Step 1. Go to Page > Choose Your Page > Edit Page Properties
Step 2. Click on Behaviour Tab > Enable/Disable “Cache page as static file” checkbox.
Global Settings of TYPO3 StaticFileCache Extension
The extension provides the rich feature to configure global-level configuration.
Step 1. Go to Admin Tools > Settings Module
Step 2. Search and click on “staticfilecache”, Keep exploring and experimenting with all the features.
Tips & Tricks for TYPO3 Cache
Here are some tips and tricks to smartly configure TYPO3 staticfilecache.
Disable Clear-Cache For Editors
You can create an intelligent strategy to avoid every clear time cache by your TYPO3 editors. Simply configure below UserTSConfig.
// Disable TYPO3 Pages Clear Cache
options.clearCache.pages = 0
options.clearCache.all = 0
Disable Cache for Logged-in Users
Let’s simply disable the TYPO3 cache while anyone is logged in at the TYPO3 backend - so they will always see the latest version. You can configure the below TypoScript.
// Enable TYPO3 Cache for Logged-in Users
[backend.user.isLoggedIn]
config.no_cache = 1
[global]
Common Error “The page is not static cacheable via TypoScriptFrontend’
It’s not the problem of the TYPO3 staticfilecache extension; You will need to resolve it for your TYPO3 instance. Generally, this causes problems when using 3rd party TYPO3 extensions - Try to disable and the error will go!
Boost Mode in TYPO3 StaticFileCache
Set Boost-mode from Admin Tools > Settings > Extension Configuration > Staticfilecache > Enable Boost Mode.
Then the extension will not delete cached files while your backend editor makes any changes. You will need to configure one task in the TYPO3 scheduler to re-crawled such edited pages. In this way, your site visitor will always get cached pages. Every time, Your site will be super fast.
Disable Cache at Development Mode
Set Disable In Development from Admin Tools > Settings > Extension Configuration > Staticfilecache > Enable Boost Mode.
Whenever you have TYPO3 Context = Development, the extension will disable the TYPO3 static file cache mechanism.
Closure!
Thanks for reading my article. I hope you learned and explored well about this TYPO3 super cache extension.
Do you use any other smart way to cache your TYPO3 site? Are you facing any issues with this EXT.staticfilecache TYPO3 extension? I would love to connect with you in the comment box.
Have a Happy TYPO3 Super Caching!
Sanjay Chauhan
CTO at T3Planet & NITSANSanjay Chauhan, Co-Founder of NITSAN (Award winning TYPO3 agency) and Pioneer of T3Planet (first-ever TYPO3 Store).
A true TYPO3 fanatic since 2010. I bring strong TYPO3 experience in building customer-business…
More From Author