A
A
Apxu2017-10-09 16:12:44
PHP
Apxu, 2017-10-09 16:12:44

Why did ajax requests for php files stop working after setting the cache in .htaccess?

Good afternoon!
A colleague decided to try setting up caching and inserted the code into .htaccess which is displayed at the end of the question. After that, all Ajax requests that go to .php files return a 500 error. It feels like the empty .php files to which the request is being made are cached. It helps only to resave the file, then the error disappears, but only for a while. I removed the code from .htaccess, but errors still occur from time to time. Who faced similar? Is there a way to fix this somehow?
Thanks in advance.

<ifModule mod_expires.c>
    # Add correct content-type for fonts
    AddType application/vnd.ms-fontobject .eot
    AddType application/x-font-ttf .ttf
    AddType application/x-font-opentype .otf
    AddType application/x-font-woff .woff
    AddType image/svg+xml .svg

    # Compress compressible fonts
    AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml

    ExpiresActive On
    ExpiresDefault "access plus 5 seconds"

    # special MIME type for icons - see http://www.iana.org/assignments/media-types/image/vnd.microsoft.icon
    AddType image/vnd.microsoft.icon .ico
    # now we have icon MIME type, we can use it
    # my favicon doesn't change much
    ExpiresByType image/vnd.microsoft.icon "access plus 3 months"

    # Cache Images
    ExpiresByType image/x-icon "access plus 2592000 seconds"
    ExpiresByType image/jpeg "access plus 2592000 seconds"
    ExpiresByType image/png "access plus 2592000 seconds"
    ExpiresByType image/gif "access plus 2592000 seconds"
    ExpiresByType image/svg+xml "access plus 2592000 seconds"

    # Cache Fonts
    ExpiresByType application/vnd.ms-fontobject "access plus 2592000 seconds"
    ExpiresByType application/x-font-ttf "access plus 2592000 seconds"
    ExpiresByType application/x-font-opentype "access plus 2592000 seconds"
    ExpiresByType application/x-font-woff "access plus 2592000 seconds"
    ExpiresByType image/svg+xml "access plus 2592000 seconds"

    # Cache other content types (Flash, CSS, JS, HTML, XML)
    ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
    ExpiresByType text/css "access plus 604800 seconds"
    ExpiresByType text/javascript "access plus 2592000 seconds"
    ExpiresByType application/javascript "access plus 2592000 seconds"
    ExpiresByType application/x-javascript "access plus 2592000 seconds"
    ExpiresByType text/html "access plus 600 seconds"
    ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question