My permalinks are broken! Can I use mod_rewrite to ignore a physical file?

The reason that’s happening at all is because of content negotiation. /2011.html wouldn’t normally be accessible through /2011/, but content negotiation is making Apache automatically look for files named 2011 (whatever the extension) when it can’t find the folder before it passes control to WordPress.

This can be quite useful, but if you don’t particularly need content negotiation (WordPress itself doesn’t need it), you can turn it off by adding this to your .htaccess:

Options -MultiViews

If that doesn’t work, or you do need content negotiation, you could rename the 2011.html to something else, and use mod_rewrite to make sure the link still works. E.g. rename 2011.html to happynewyear.html and then add this to your .htaccess (before the other RewriteRules):

RewriteRule ^2011\.html happynewyear.html [L]

Leave a Comment