WordPress.org

Ready to get started?Download WordPress

Forums

.htaccess/expires headers issue (3 posts)

  1. leer
    Member
    Posted 4 years ago #

    I'm trying to optimize my site, so I created the following .htaccess file in my web root (http://expat.cl):

    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault A300
    ExpiresByType application/x-javascript A3600
    ExpiresByType text/css A3600
    ExpiresByType image/gif A3600
    ExpiresByType image/png A3600
    ExpiresByType image/jpeg A3600
    ExpiresByType text/plain A300
    ExpiresByType application/x-shockwave-flash A3600
    ExpiresByType video/x-flv A3600
    ExpiresByType application/pdf A3600
    ExpiresByType text/html A300
    </IfModule>

    That, predictably, broke my permalinks, but I regenerated them and all was well. The file now looks like this:

    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault A300
    ExpiresByType application/x-javascript A3600
    ExpiresByType text/css A3600
    ExpiresByType image/gif A3600
    ExpiresByType image/png A3600
    ExpiresByType image/jpeg A3600
    ExpiresByType text/plain A300
    ExpiresByType application/x-shockwave-flash A3600
    ExpiresByType video/x-flv A3600
    ExpiresByType application/pdf A3600
    ExpiresByType text/html A300
    </IfModule>
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    YSlow is telling me that I still don't have my expires headers set (I do have some set via the Autoptimize plugin).

    Is there something wrong with the mod_expires settings above? Why is my server ignoring the file?

    Thanks

  2. leer
    Member
    Posted 4 years ago #

    So it turns out my host doesn't have mod_expires installed in the Apache instance on my server. What alternatives are there for setting them in via WordPress? (e.g. whatever Autoptimize does)

  3. cadbloke
    Member
    Posted 4 years ago #

    Have a look here: http://www.samaxes.com/2008/04/htaccess-gzip-and-cache-your-site-for-faster-loading-and-bandwidth-saving/

    look for <ifModule mod_headers.c> You can modify expiry times via this too.

Topic Closed

This topic has been closed to new replies.

About this Topic