How to create and edit htaccess file in WordPress
Many WordPress users are still not aware of .htaccess file and how to create it in WordPress. An .htaccess file is a low-level file that gives instructions to the server.WordPress uses it to create things like permalinks.
At some point when working with WordPress you will likely have to create and edit this file.The file goes directly in the root directory up the WordPress install and should have the file permissions set to 644.
Let’s see how to create and edit .htaccess file in WordPress, set its file permissions, then finally edit the file itself.
One of the areas that you will need in .htaccess file for in WordPress is to make custom permalink settings. Permalinks determine what the URL’s of your site will look like.
If you move from using the default ID based permalinks to doing something like postname base permalink which is more common and save those changes
you should get a message saying you should now update your .htaccess file
and down below on the bottom of the page we could see a message that says if your htaccess file were writable WordPress would update this file for you automatically.
However because this file does not yet exist and is writable, you’ll have to manually update this file.What you are going to do is, creating .htaccess file, make it writeable, come back here update your settings and let Word Press do the rewriting for us.
To start off let’s go into our text editor and create a new file.We will leave this file blank for now and we’ll just go ahead and save it has .htaccess.
Now any time a file starts with dot it tells the system that this is not an ordinary file and then it’s actually giving instructions to the computer or the server itself.When you go to click save, it will give you a message about that and want to confirm that you do want to use a dot at the beginning over file name: You will go ahead and click use.
Now that after having this saved, jump over to the Finder and go ahead and look for this file that you just saved.
After saving it into this WordPress folder, you can see that it doesn’t show up here.The reason it doesn’t show up is that files that begin with the dot are usually reserved in hidden from view within finder. However if you use software like FileZilla or FTP software and you are coming look into that same folder, you can see that the .htaccess file is there, you are just not able to see it within finder.
After dragging this file from your local server up onto your live server, you want to make sure that the file has the correct file permission so that WordPress can write to it.To do this select the file, right click and check file permissions.
You can see that it is set to 755 which is actually okay. So we’ll go ahead and save this, come back into Word Press, refresh your page and click Save Changes again.
We can see that it says the permalink structure has been updated and WordPress is now taking care of editing your .htaccess file.
You may find that in some situations WordPress will automatically create .htaccess file for you but you will also often need to create this file on your own. You should now know though everything you need in order to create and edit an .htaccess file.
Latest posts by Christine (see all)
- Top 5 Ways to Wire up ESP8266 Module to your Arduino Uno Board - September 22, 2017
- Get started with a Fingerprint Sensor Module using Arduino - September 13, 2017
- How to Print AT Commands with ESP8266 using USB TTL Converter - September 12, 2017