Today I had a eureka for making a page load faster

Actually it was late yesterday while surfing for how to implement Laravel file caching.

I discovered only two .htaccess lines are required to test if a file is in a cache folder. If the file exists then display the file else fall through and load PHP, Laravel, MySql, etc.

It is quite easy to test by displaying a Laravel generated file, viewing the source of the URI and saving to the Cache folder using the named URI with a .html extension.

No doubt this is not new to many who are familiar with Apache but to me was innovative and a revelation. I really like the idea of using Apache for what is was designed to do rather than loading numerous libraries to achieve a slower result.

For those who are interested I will not spoil the fun of discovering for yourself the two lines necessary which is far better than mindlessly copying and pasting :slight_smile:

Also delighted to discover that URIs with paths are also respected, only required to duplicate the path in the cache folder.

Next task is how to automate the procedure, I could possibly use the genenerated sitemap.xml to obtain the URIs and then use Php to file_get_contents(…) then save the string to cache/URIs.html.


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.