Eureka for Making a Web-Page Load Faster

Monday, 29th May 2023 - 15:12:58 pm

Actually it was late yesterday while surfing for how to use 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 with the same URI and a .html extension.

No doubt this is not new to many who are familiar with Apache but to me was 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 :)

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

The technique should also work for any other PHP Framework, CMS Systems, WordPress, etc

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.

HTML: Validator CSS: Validator Support: Captain Tom Moore