WordPress, the world’s favourite tool for website construction began as a user-friendly publishing platform that gradually expanded and conquered the industry. It doesn’t take any knowledge of the underlying files and directories to instal WordPress and run the web. But you could find yourself in a situation one day where some awareness of WordPress files is needed. The .htacess file is an important WordPress file you’d like to find out more. Here we will teach you how you can edit WordPress files with .htaccess.
If you have run a WordPress website for a long time, at some point you may have had the urge to browse and update the file. The .htaccess file, which is stored on your web server, will help you block IP addresses, limit access to WordPress files, launch custom error pages, and a variety of other items.
It is no easy job to modify .htaccess. A broken website will result in one minor fall. But you don’t have to fear, because without breaking your website, we’re going to guide you through the process of finding and editing the .htaccess code.
What is .htaccess File?
When you first update WordPress, the file .htaccess is created on its own. It’s an incredibly important file which helps you to give the hosting server detailed instructions. The file is used to execute tasks such as redirecting, changing the setup of your website, and even protecting your WordPress account.
For example, with the aid of .htaccess, if you are revamping your website and want to limit access to a page, you can secure it with a password. If you want to try it out we have a manual on How to Password Secure a Site with Htaccess.
Where is the .htaccess File Located?
You can find the WordPress htaccess file at the root of your WordPress installation. What is that meant to mean? Let’s go back a bit.
Most files and directories stored in an organised fashion are made up of WordPress pages.
Dream of a Russian Doll to grasp the WordPress file system. The toy consists of a collection of wooden dolls hollowed out and comes in various sizes. Inside a larger doll, each doll is nesting.
In the same way, tiny files on the website nest inside larger archive files. The public-html folder is the main WordPress file and is also referred to as the root folder. This root folder holds the file .htaccess.
How to Find a WordPress .htaccess file?
The file with .htaccess is normally secret. The explanation is that it is a very valuable file and WordPress needs to protect it from any future threat, such as unintentionally removing it.
You will need to log into your WordPress hosting account and navigate to cPanel to find the .htaccess address. Open the File Manager from there and then pick the public html folder.
Since the .htaccess file is secret, you will need to make it clear by selecting Configuration, which is normally located in the cPanel File Manager’s right-hand corner. A window will pop out as soon as you pick Settings. Pick the Show Concealed Files option from there.
Now, go back to the public_html folder and the .htaccess will should be visible.
Now that you know how to find the file, let us show you how to edit it.
How to Edit the .htaccess WordPress File?
There is more than one way of editing the .htaccess file. In the next few paragraphs, we are going to show them all.
- Edit htaccess WordPress File From cPanel
- Edit htaccess WordPress File Using FTP Client
- or Edit htaccess WordPress File With a Plugin
It’s Hold Tight! You Should Take Backups
Create a complete website backup before you edit the WordPress .htaccess file. The value of the file and the possibility of losing it unintentionally can not be adequately emphasised. In addition, when you update the .htaccess file, the change you wanted to see on your web, it will not work out how you expect it to. Or worst, the site is broken. Whatever happens, you can easily return the site back to normal if you have a backup. Oh, no sweat.
Yeah, let’s teach you how to edit your file with .htaccess.
1. Editing .htaccess File From cPanel
Log in to your hosting account, navigate to cPanel and select the File Manager option.
Go to the folder public html from the File Manager. In this location, the .htaccess file is stored. Right-click when you see it and then pick Edit.
That’s it. Now you can insert snippets of codes to make modifications to your website.
2. Editing .htaccess File Using FTP Clients
Another way to update a file with .htaccess is to use an FTP client. Think of it as a tool that links your website to your computer, for those who do not know what an FTP client is. You can browse your website files from your local device by using an FTP client such as Filezilla without having to log into your hosting account. Here’s how you can use the FTP client to edit the .htaccess file.
Step 1: Install Filezilla
Download and instal Filezilla on your machine (the most common FTP client). Open it once mounted.
Step 2: Find Your FTP Credentials
You will now need to connect Filezilla to your website and you will require your FTP credentials to do this. You can inquire for it from your hosting company, but if you want to look for it on your own, here are two tools that will allow you to manually locate FTP credentials and videos to find your FTP credentials.
Four items consist of the FTP credentials-hostname, email, password, and port number.
On Filezilla, at the top of the browser, there are options where you can insert FTP credentials. Tap on Quickconnect after you have done that and let the app connect to your website.
Step 3: Locate & Edit the .htaccess File
Filezilla is organised into two sections. You’ve got a local site on the left that gives you a bunch of files from your local computer. And the remote site is on the right, which displays a lot of files from your website.
Pick the public html folder from the remote site. The folder material is shown in the File Name section, located just below the Remote Site section.
Right-click and pick Edit when you find the .htaccess format.
That’s it folks. Next, we’ll show you how to edit your .htaccess file using a plugin.
3. Editing .htaccess File With a Plugin
It can seem a bit dangerous to edit the .htaccess file using both the cPanel and FTP client because you have to go to the site’s backup and then edit the file. Many owners of websites do not access WordPress files, and at first it can seem a little daunting. It wouldn’t be shocking in such a state to make a mistake. A secure choice is to use a plugin.
There are quite a few plugins in the .htaccess file editing repository, but we choose the Htaccess Editor after careful thought. About 50,000 active instals and over two dozen 5-star reviews are available for the plugin. We also hear from the archive tab that it’s regularly modified. To pick the proper plugin, Htaccess Editor ticks all the boxes.
However before downloading the plugin, try to set up the website and only instal the plugin to check if it creates problems with compatibility. Compatibility problems may end up creating problems, such as the misbehaviour of the site and some of the plugins which quit functioning. Here’s a nice article about how a WordPress website should be set up.
If you’ve checked it it’s time for a plugin to edit the .htaccess file.
On your WordPress website, instal and trigger HTACCESS Editor.
Then go to the Configuration tab on the website dashboard, and then pick WP Htaccess Editor. Without needing to quit your WordPress dashboard, this will take you to the .htaccess file. Insert some fragment of code and remember to save the modifications.
All that’s folks!
Oh, congratulations! On your path towards being a WordPress specialist, you have taken your first step. Jokes aside, it would be helpful to learn to deal with .htaccess and there is a broad range of stuff you can do with the .htaccess file.
In addition, providing more than one way to edit the file is beneficial so you can use the other one if you find one form challenging. And you can easily navigate to the public-html folder once you get the hang of it, open and edit the .htaccess file. You can now apply any features you need to your website by editing the code. But before making any edits, make sure the backups are taken.