How To Add A .htaccess File To Your Site
About This Lesson
In this lesson I’ll walk you through how to add a .htaccess file to your site.
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,
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,
- Right click on your desktop and simply create a new text document
- 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).
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.
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,
- In FileZilla right click on the file and choose “Rename”
- 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,
- Right click on the .htaccess file and go to “file permissions”
- 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 should now be able to save these changes. To confirm this has saved you’ll get the following message.
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,
- In FileZilla right click on the .htaccess file and go to “file permissions”
- Where it says “Numeric value”, put 644
And that’s it for this lesson.
If you’re interested in more tutorials like this, check out my individual tutorials page.