I have several URLs on my website that get redirected to other URLs using Mod-Rewrite. For example:
RewriteRule ^section$ /newsection [NC,L,R=301]
I then proceeded to test the page using webpagetest optimizer at webpagetest.org and The redirect page received and error as follows:
Leverage browser caching of static assets: ##/100 FAILED - (No max-age or expires) - http://example.com/section
So then I proceeded to visit the same page via CURL command line tool and the results are as follows:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="http://example.com/newsection">here</a>.</p> </body></html>
HTTP/1.1 301 Moved Permanently Date: Sun, 08 Mar 2015 18:09:18 GMT Server: Apache Location: http://example.com/newsection Content-Type: text/html; charset=iso-8859-1
Is there a way that I can add a cache-control or an expires header with a far future date only to pages that return a 301 or 302 status code so that users dont have to make a trip to the network only to load a redirection page?