Search code examples
wordpress.htaccesslinode

Linode ignores .htaccess


This is my .htaccess (wordpress site) on a linode instance. It does not work even when I try to break it.

# BEGIN WordPress
<IfModule rewrite_module>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress 

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##

Solution

  • Make sure you have the AllowOverride directive setup for the directory (or document root) that your htaccess file is in.

    For example, if your htaccess file is in /var/www/htdocs/ then make sure your vhost config has something like:

    <Directory "/var/www/htdocs">
        AllowOverride All
    </Directory>
    

    Or at the very least, that directive for a parent directory. I think at the very least you'll need FileInfo if you don't want to turn on all override options:

    <Directory "/var/www/htdocs">
        AllowOverride FileInfo
    </Directory>