Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is PHP discriminating between .php and .abc extensions for caching?
    primarykey
    data
    text
    <p>There seems to be a problem between how PHP engine handles identical files that differ only in their file extension.</p> <p>Problem: <em>"An If-Modified-Since conditional request returned the full content unchanged."</em> </p> <p>Also, I measured that the .php extension loads much faster than identitcal twin with .xxx extension even though the file contents are identical, and they differ only in their file extension.</p> <p><img src="https://i.stack.imgur.com/agirw.png" alt="alt text"></p> <p><img src="https://i.stack.imgur.com/UwRax.png" alt="alt text"></p> <blockquote> <p>"HTTP allows clients to make conditional requests to see if a copy that they hold is still valid. Since this response has a Last-Modified header, clients should be able to use an If-Modified-Since request header for validation. RED has done this and found that the resource sends a full response even though it hadn't changed, indicating that it doesn't support Last-Modified validation."</p> </blockquote> <hr> <h3>homepage ending with <code>.php</code></h3> <p><img src="https://i.stack.imgur.com/J3Inv.png" alt="alt text"></p> <hr> <h3>exact same file, but ending <code>.ast</code></h3> <p><img src="https://i.stack.imgur.com/WiXkQ.png" alt="alt text"></p> <hr> <p><strong>Given:</strong> </p> <p>A home.php file is copied as home.xxx and this extension is added to htaccess to recognize it as a PHP file. The .php file listen to the php.ini where freshness is set to 3 hrs, the non .php files have to listen to htaccess where freshness is set to 2 hrs according to:</p> <pre><code>AddType application/x-httpd-php .php .ast .abc .xxx .etc &lt;IfModule mod_headers.c&gt; ExpiresActive On ExpiresDefault M2419200 Header unset ETag FileETag None Header unset Pragma Header set Cache-Control "max-age=2419200" ##### DYNAMIC PAGES &lt;FilesMatch "\\.(ast|php|abc|xxx)$"&gt; ExpiresDefault M7200 Header set Cache-Control "public, max-age=7200" &lt;/FilesMatch&gt; &lt;/IfModule&gt; </code></pre> <p>So far so good and everything loads, except, the non-php file doesn't cache properly, or it does cache well but doesn't validate well, to be more specific. See images enclosed. Only the non-php file extension causes the error and loads slower.</p> <p>The entire page.php loads faster as somehow all the elements in there then load properly from cache, while the page.abc has the full request returned while it ought to be cached, meaning the entire page is slower.</p> <p>Bottom line: What should be changed, in order eliminate the If-Modified-Since conditional request returning the full content unchanged?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload