Expires headers in .htaccess

Discussion in 'General' started by sophrosyne, Dec 9, 2011.

  1. sophrosyne

    sophrosyne New Member

    Hi,

    When I set the ExpiresByType headers in a site's .htaccess file, it somehow screws up the php handler causing the server to send php scripts as downloads instead of parsing them.

    Have you ever seen this before?

    Using CentOS 5.7,
    Litespeed Web Server Enterprise v4.1.8

    Thanks,
  2. webizen

    webizen New Member

    assuming php serves normally once the headers get removed from .htaccess. if so, please provide a snippet of the headers for our troubleshooting.
  3. sophrosyne

    sophrosyne New Member

    Hi,

    Yes, with the headers commented out, PHP serves fine. Here's the section:

    ############################################
    ## Add default Expires header
    ## http://developer.yahoo.com/performance/rules.html#expires

    ExpiresActive On

    # ExpiresDefault "access plus 1 year"
    # ExpiresByType image/x-icon "access plus 1 year"
    # ExpiresByType image/png "access plus 1 year"
    # ExpiresByType image/gif "access plus 1 year"
    # ExpiresByType image/jpg "access plus 1 year"
    # ExpiresByType application/x-javascript "access plus 1 year"
    # ExpiresByType application/javascript "access plus 1 year"
    # ExpiresByType application/js "access plus 1 year"
    # ExpiresByType text/css "access plus 1 year"
    # ExpiresByType text/html "access plus 1 year"
    # ExpiresByType text/xml "access plus 1 year"
    # ExpiresByType text/plain "access plus 1 year"
    # ExpiresByType image/jpeg "access plus 1 year"
    # ExpiresByType text/javascript "access plus 1 year"

    I tried uncommenting them one by one, but even after the ExpiresDefault I get the error.

    Thanks!
  4. mistwang

    mistwang LiteSpeed Staff

    Tried those directives in .htacess, works fine. we probably need the whole .htaccess in order to reproduce it in our lab.
    How about adding

    AddType application/x-httpd-php .php

    to the .htaccess?

Share This Page