10 htaccess Hacks Every SEO Should Know

Sent to you via Google Reader

10 htaccess Hacks Every SEO Should Know

There’s a lot that you can do with an htaccess file, and of course, things can get pretty advanced in a hurry. Here, we’re going to keep things pretty simple. These are the 10 basic htaccess hacks that every webmaster should know.

1. Force Caching with htaccess

Use: The following htaccess code won’t help the initial pageload, but it will significantly help subsequent pageloads by sending 304 status when requested elements haven’t been modified.

FileETag MTime Size
ExpiresActive on
ExpiresDefault “access plus x seconds”

I generally set the cache for one day (86400 seconds). You can also set different expirations for each file type by breaking each file type up into separate ExpiresByType lines such as:

ExpiresByType image/gif “access plus x seconds”
ExpiresByType text/css “access plus x seconds”


2. Set a Custom 404 Page with htaccess

Use: I think this one is self explantatory. Just change ‘/notfound.html’ to match the path to your custom 404 page.

ErrorDocument 404 /notfound.html

3. Implement a 301 Redirect with htaccess

Use: If you have permanently changed the URL structure on your site (via either optimization change or CMS migration), you will want to implement 301 redirects from the old URL to the new URL.

The syntax for a basi…

Sent from my iPhone

Posted via email from Tim’s posterous

Related Posts Plugin for WordPress, Blogger...



Not in the least bit copyrighted by Tim Aldiss 2012