From 65c855a1680909fcb1c44104809b246920e872a8 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Sun, 4 Jun 2023 10:05:49 +0100 Subject: [PATCH] Plugin to add Cache-Control headers to robots.txt --- robots-txt-cache.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 robots-txt-cache.php diff --git a/robots-txt-cache.php b/robots-txt-cache.php new file mode 100644 index 0000000..ef4a6aa --- /dev/null +++ b/robots-txt-cache.php @@ -0,0 +1,14 @@ +<?php +/* + * Plugin Name: A/I - Robots.txt caching + * Description: Add cache-control headers to robots.txt + * Version: 0.0.1 + * Author: Autistici/Inventati + * Author URI: https://autistici.org + */ + +function ai_robots_txt_add_cache_headers() { + header("Cache-Control", "max-age=86400"); +} + +add_action('do_robotstxt', 'ai_robots_txt_add_cache_headers'); -- GitLab