Create and Use an .htaccess File


An .htaccess file is a configuration file that allows you to have greater control over elements of your website, such as security and performance. You can use this file to, for instance, create redirects or change your default connection to “keepalive.” If you don’t have access to your server’s config file, you can create your own .htaccess to manage your website and make changes. How do you create such a file, and…then what do you do with it?

Let’s start with creating it. It’s a simple text file – and you may have one already. Your webhost should give you the option to “see hidden files” when you open your file manager. If you do so, and do not see .htaccess, then you don’t have one! You may also see that there is more than one. If you have one in the root level, or www folder, you’re good. If not, you’re still good, but you have a bit more work to do!

Open a text program, such as Notepad, and save an empty pave as .htaccess. Notepad will name it .htaccess.txt. Remove the .txt, or other extension if you’re using another text program. Just right click on the file and rename just .htaccess. If you don’t do that, you can’t add directives to the file. Well, you can, but no one will listen.

Editing your .htaccess file is simply a matter of opening this file and making your changes. With a big “but.” Changes you make to your .htaccess file can have an impact on your entire website. Some bad code or some wonky arrangement can really do some damage. Before you edit, make a copy of your file. If you do make one of those types of mistakes, simply go back to the file, delete, paste your old copy in, and your website will go back to normal.

It’s also a good idea to check your changes as you go. When you make a change, go to your website, refresh, and see if it is displaying correctly. This way, you don’t make 50 changes and have to backtrack to figure out what the problem is – or waste time making 50 changes only to have to delete them all and go back to the old copy (which you should always have because the old copy is way better than no copy!).

So, now that you know how to access or create and then edit your .htaccess file, what can you do with it? We’ll take a look at some edits that will help your SEO efforts in our next post.

Leave a Comment