Even when a site is otherwise optimized, failing to have a properly configured .htaccess file is a mistake you can’t afford to make. Use this guide as a checklist to avoid neglecting the core of your site.
Disclaimer…
* If you are able to configure your “httpd main server config file,” use that instead.
* This is only for sites using Apache.
* Certain CMS and E-Commerce platforms may allow these settings to be edited through the administration panel instead.
Some servers may not have “mod_rewrite” enabled by default. Add the following line to your site’s root .htaccess file one time to ensure mod_rewrite is enabled:
Depending on your server configuration, you may or may not need the following line after “RewriteEngine on”:
In a perfect world, choosing the www or non-www version of a domain and setting up a permanent redirect is something done during a site’s infancy. In reality, this just isn’t happening with a large number of websites.
Redirect non-www to www
Replace yoursite.com with your domain!
Redirect www to non-www
Replace yoursite.com with your domain!
How it impacts SEO
Aside from duplicate content, not deciding on a primary URL structure lowers domain authority, dilutes link-building efforts and sends mixed signals to search engines about which version of a page you want indexed. Why distribute incoming link juice to two technically different URLs when you can send it all to one?
Note that for those of you using WordPress or various CMS/E-Commerce platforms, these settings are often taken care of by default or configured through the administration panel.
As a site grows, ages and develops, there are pages that will inevitably become outdated or irrelevant. Other times, you may wish to condense two or three similar pages into one. A 301 redirect is the answer.
Redirect an old page to a new page
Replace yoursite.com with your domain!
Redirect several pages to one
Replace yoursite.com with your domain!
How it impacts SEO
301 redirects are a great way to preserve traffic and some of your pagerank. 301 redirects also provide visitors with actual content instead of a 404 error page or something no longer relevant.
Another great use for 301 redirects is condensing multiple pages into one. Often times a site will have several pages with very thin or similar content, with nearly identical URL structures and title tags. Choosing the more established page and permanently redirecting the others will help to build additional page authority and link juice, as well as prevent any duplicate content. By getting rid of irrelevant or near-duplicate pages and instead focusing on one, you can focus on a single, highly valuable piece of content and create a better experience for visitors.
If you’re using WordPress, make it even easier with the Simple 301 Redirects plugin.

Custom error pages provide a great opportunity to be creative and show a bit of your personality. Reddit does a great job of this (pictured right).
Whatever route you take, be sure to also include links to the main sections of your site.
Specify your error page locations
404.html should be replaced with the actual page name you wish to use as your 404 page. The same holds true for the other four.
How it impacts SEO
In short, it keeps visitors on your site. When visitors arrive at a default error page, their initial instinct is to hit their “back” button and try another site instead. By setting up custom error pages, it gives you the chance to keep visitors on your site by instead providing them with helpful links they can follow (and perhaps a bit of humor!).
If not disabled by default, it’s usually best to disallow directory browsing. If you have a folder called /secret, for example, but no default index page, people will be able to browse the entire contents of the folder if directory browsing is enabled.
Disable directory browsing
If you wish to enable directory browsing, that can be done as well.
Enable directory browsing
Because .htaccess is the extension, that’s how you should save the file. It’s not htaccess.html or index.htaccess; it’s simply .htaccess.
When you go to save the file, choose “Save as type: All types (*.*)” and name it .htaccess. Upload it to your root directory.
For additional reading and to learn about all of the functions that can be accomplished through .htaccess, refer to the following links:
W3Schools Forums
Perishable Press
Tags: .htaccess seo
Great article. I knew about most of the .htaccess rules, but not their SEO impact. Also, have never seen them all in one place. Makes a great checklist.
Now I need to get to work on some creative error pages…in my spare time
Thank you, Pat. Looking forward to seeing those error pages!
Good Info in this Article and well presented. One thing I might want to add is that some CMS systems like WordPress and E-Commerce Carts manage the htaccess for you and many of these features are done in there well. Redirects and www to non www redirects are two examples.
I think for most people that is an easier way to work on these.
Also downloading and editing htacess is a little strange and seeing the file and editing it might mean changing settings to see hidden files and getting a good FTP program. Filezilla works well.
Some great points, Michael! I have added a few details to the article mentioning such possibilities. Thank you for taking the time to comment.
This was a great blog. There was so much I learned here in reading it. I’m about to put all your suggestions into practice this very minute! Thanks again.