How To Add A .htaccess File To Your Site

You should update your htacess file

About This Lesson

In this lesson I’ll walk you through how to add a .htaccess file to your site.

This particular .htaccess file is for those people who manually installed WordPress, who when the try to save changes in their WordPress permalinks settings, they get the following message,

You should update your .htaccess now.

If you see that message, it means you’ll have to create a .htaccess file and upload it to your site. (Don’t worry, it’s pretty simple to do.)

Here’s the steps you’ll need to take,

1) Create the .htaccess file

2) Upload the .htaccess file to your server

3) Remove the .txt

4) Temporarily set the file permissions to 777

5) Make the changes in your permalinks settings and save them

6) Set the file permissions to 644

Prerequisites

Because you’re going to be adding a file onto your server, you’ll need to know what FileZilla is and how it works, see my FileZilla tutorial.

Read All About It

Step 1/6 – Create The .htaccess File

To begin with, we’re going to create the .htaccess file.

To do that,

Creating The htacess File

  1. Right click on your desktop and simply create a new text document
  2. Save it with the name .htaccess

You don’t need to put anything in the actual file.

Step 2/6 – Upload The .htaccess File To Your Server

Then you’ll need to connect to where your WordPress files are being hosted, using the program FileZilla. (If you don’t know what FileZilla is, or how to use it, see my tutorial here).

Login To Filezilla

Once you’re connected to your site in FileZilla, you need to upload the .htaccess file into the same location as in your, “Site address (URL)”, which you can see in your general settings.

Site Address URL

So in the above example it means I need to add the .htaccess file into the root domain of my site, which is (www.ryanlove.com), but in FileZilla it’s, “public_html”.

Which you can see I did in the image below.

Upload The htaccess File To Your Site

Step 3/6 – Remove The “.txt”

Then you need to rename the .htaccess file so it doesn’t have the .txt at the end.

To do this,

Remove The txt

  1. In FileZilla right click on the file and choose “Rename”
  2. Simply delete the bit that says .txt, so it’s now just .htaccess

Step 4/6 – Temporarily Set The File Permissions To 777

Then you need to temporarily set the file permission to 777. This is so you can save the changes in the permalink settings.

To do this,

Set File Permissions To 777

  1. Right click on the .htaccess file and go to “file permissions”
  2. Where it says “Numeric value”, put 777

By the end of this process you’ll need to change this from 777 to 644. But I’ll remind you of that in step 6 below.

(If you want to learn more about file permissions visit WordPress.org.)

Step 5/6 – Make The Changes In Your Permalinks Settings And Save Them

You then need to go into your WordPress admin area and make the changes in your WordPress permalinks settings.

You should now be able to save these changes. To confirm this has saved you’ll get the following message.

Permalink Structure Updated

Step 6/6 – Set The File Permissions To 644

Finally you need to change the file permission of the .htaccess file so it’s 644. We only needed to temporarily set it to 777, while we saved the changes in WordPress.

However you don’t want to keep it at 777, as this could potentially be a security risk.

To change the permissions,

Set File Permissions To 644

  1. In FileZilla right click on the .htaccess file and go to “file permissions”
  2. Where it says “Numeric value”, put 644

All Done

And that’s it for this lesson.

If you’re interested in more tutorials like this, check out my individual tutorials page.