This is the XMLHttpRequest:
$.ajax({
    method: "get",
    url: "getPage.php",
    data: $data,
    dataType: 'json',
    timeout: 2000,
    success: function(result) {
        handleContent(result);
        }
    });
This is getPage.php?data=data
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT");
header("Cache-Control: max-age=" . $offset . ", public");
header("HTTP/1.1 301 Moved Permanently");
header("Location: $location);
This is $location:
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT");
header("Cache-Control: max-age=" . $offset . ", public");
print $print;
The client browser properly caches $location. However it does not cache the redirect in getPage.php?data=data
Every time the ajax-request is called it requests a GET getPage.php?data=data.
I would like it to automatically GET $location instead (or rather try GET $location and get the page from cache).
Is this not what 301 Permanent Redirect is for? Creating a redirect which is cached by the browser (plus some proxy, search engine etc. stuff of course)?
Please do not question why I choose to do it this way. I have reasons for this which I am not going to go into here. All I want is an answer and possibly a solution which lets the 301 redirect get cached resulting in no GET requests at all after a first request.
Thanks in advance!
 
     
     
     
     
    