The Basics

Introduction to the .htaccess file and how it works

Did you know your .htaccess file has an effect on your website's SEO? It does. And the effect can be massive.

Today, you're going to learn how to use the .htaccess file to fix common SEO problems. We are also going to look at SEO problems that the .htaccess file causes. It goes both ways.

I have found that the .htaccess file is one of the more powerful tools in the technical SEO toolbox. Although, it can have tremendous impact its scope is almost exclusively in the technical SEO realm.

Its effect is usually unnoticed by the average user. But, a well-written .htacces file will make your site more indexable, crawlable, deconflict ranking signals, increase page load speed and much more.

What Will We Cover?

In this guide, we will cover some of the basics and some of the advanced techniques to improve your website's performance using the .htaccess file.

Take a look at the following topics we will cover.

What is .htaccess?

The .htaccess (short for 'hypertext access') file is a distributed server configuration file. This means that it configures the server only in the directory the .htaccess file is in.

The .htaccess file allows you to set server configurations for a specific directory. This could be the root directory for your website or an /images or /downloads directory.

It is used on the Apache web server. It can also be used on a handful of other web servers like LiteSpeed. However, this guide is not written for LiteSpeed. There are some parallels between the Apache and LiteSpeed .htaccess files, but this guide should not be used for LiteSpeed.

How does .htaccess work?

The .htaccess file is placed in a directory on the web server. When this is done it will be executed by the Apache web server when a request is made from that directory. It is common to place a .htaccess file in a site's root directory e.g. /public_html. This configures the web server for the entire website. It is a little less common to place .htaccess files in a sub-directory, but it is practiced and has some specific uses

It is important to know that the .htaccess file, like any other Apache configuration file, is read from top to bottom. This means that configurations at the top will be executed before the ones at the bottom. You will need to pay attention to the order of your rules to ensure it is working correctly and efficiently.


Because the .htaccess file is a server configuration file a typo can cause your server to be misconfigured. This can result in your website not working! If you do not know what you are doing, hire or consult with a web developer. If you are feeling adventurous be sure to make backups of your original .htaccess file and proceed carefully.

Daniel Morell

Daniel Morell

I am a self-taught web developer with a passion for SEO, creating stunning websites, and organic marketing. I am a perfectionist. That means I get obsessed with the nitty-gritty details.

I live in Wisconsin's Fox Valley with my beautiful wife Emily.

Daniel Morell

I am a self-taught web developer, SEO, and builder of things (mostly digital).

I started with just HTML and CSS, and now I mostly work with Python, PHP, JS, and Golang. The web has a lot of problems both technically and socially. I'm here fighting to make it a better place.

© 2018 Daniel Morell.
+ Daniel + = this website.