3 ms·
I'm a little surprised there isn't a general purpose option inside Apache. I'd like to go into my .htaccess and say "Any GET request that matches this regex, pl
by billpg 5y ago
I'm a little surprised there isn't a general purpose option inside Apache. I'd like to go into my .htaccess and say "Any GET request that matches this regex, please cache and serve future requests from the cache for x seconds."
(I'd set it to an hour normally and 6 hours if I'm on HN.)
That sort of thing would be perfect for WordPress and similar CMSs.
- lixtra 5y agoDid you carefully read [1]? As noted by others many WP users don’t have access to the webserver or lack knowledge to configure it properly. [1] https://httpd.apache.org/docs/2.4/mod/mod_cache.html https://httpd.apache.org/docs/2.4/mod/mod_cache.html
- billpg 5y agoWordPress already has its own htaccess file for rewriting URLs into query string parameters. I wonder why it doesn't include a cache command as normal. The number of times I've gone to a page only to be faced with a MySQL error for too many connections.
- zapt02 5y agoMany plugins add dynamic pages to WordPress - e-commerce carts, membership plugins etc. If WP would just add a cache to everything they would not work. You might say that there could be an API for these plugin to register their uncached routes, but not everyone runs Apache - Nginx is also commonly used and would also need to somehow be supported. As someone who has written their own WP caching plugin, it's actually very convenient to perform the caching in PHP, because you can check for cookies and regex expressions for URLs, and there are many plugins that handle it well. For most sites I use a free one called Cache Enabler.
- mschuster91 5y agoThe people who use wordpress cache plugin are not really technical. They use 5$/month shared hosting crap where you can't configure anything more than mod_rewrite in .htaccess.
- Neil44 5y agoThe best WP cache plugins generate static copies of pages then put rewriterules in the .htaccess to serve them, which is functionally pretty close to what you describe. This way the request doesn’t touch php at all which is a big advantage.