There are lots of reasons why you would want to access your website’s .htaccess file. This very important file is used for URL redirection (or rewriting), enabling password protection, defining custom error pages, allowing or denying users, changing timezones, etc. Whatever the reason, you must first know where to find it on your host server.
This article explains how to find the .htaccess file on cPanel.
But first, what exactly is .htaccess? Simply put .htaccess (which means Hypertext Access) is an Apache file that is used by web servers to apply settings at a directory (folder) level. To stay on topic, this article will not provide a detailed discussion of .htaccess. If you would like a more detailed breakdown, check out my previous article on the subject.
Locating the .htaccess File on cPanel
To begin, Access your cPanel by visiting your domain URL with /cPanel appended to it. So, if your domain name is say, ficticiousdomain.com, the address you should visit would be ficticiousdomain.com/cpanel
Note: The method described above for accessing cPanel is a shortcut method. Not all web hosts may support that method. However, because of cPanel’s popularity, it is relatively easy to get your cPanel URL directly from your web hosting portal. Just look around whatever dashboard your web host provides and you should find the cPanel link pretty quickly.
Next, you have to fill in your credentials (username and password) to access cPanel.
Now let’s find the .htaccess file. Go to File Manager and open the public_html folder (if you don’t have a public_html folder, look for a www folder instead). This is your website’s root folder, and your .htaccess file lives inside this folder!
If you cannot immediately find the .htaccess file inside your root folder, the problem would likely be because of the default setting that keeps hidden files (like the .htaccess file), well, hidden.
To fix that, go to settings located at the top right-hand corner of your file manager. You will see a checkbox to Show hidden files. Ensure that the box is checked and press Save. All hidden files with a dot (.) prefixing them will now appear listed, including your .htaccess file.
You can now perform all the tweaks and configurations you planned to do inside the .htaccess file.