Using .htaccess configuration file you can override certain server level configuration settings on your website. Usually this file does not exist on your website unless you make certain changes in your site permalink structure. Apart from handling permalinks, you can also use this file to set up 301 permanent redirects, enable/disable directory browsing, enhance security of your website, protect admin area etc. Basically this file contains various rules for your website directory. This article covers how to find your site’s .htaccess file in cPanel.
The .htaccess file exists in your site’s root directory and its name starts with .[dot] which makes it a hidden file. That’s why, when you access your site’s root directory using an FTP client you won’t see hypertext access file. However, you can use some methods to make it visible and then you can edit your .htaccess file.
How to Find .htaccess File in cPanel
It’s a very easy task all you need to do is just add “&showhidden=1” after your root directory URL. This is an easiest way to find .htaccess file and I use it. Let me show you how to do so.
Warning: The .htaccess file should be configured carefully because due to wrong configuration you may lose access to your site or something worse than that may happen.
First of all, login to your hosting account. In my case, I’m using Bluehost hosting and from my hosting dashboard, I’m going to click on File Manager under Files. I’m assuming you already know how to reach to root directory of your website therefore I’m not adding screenshots.
Once you click on File Manager, a pop-up box will appear on your computer screen. Now, select a directory whose .htaccess file you want to access and check box next to ‘show hidden files’. Subsequently, hit Submit button.
After hitting Submit button, .htaccess file will be visible on your root directory.
If it does not happen then just add “&showhidden=1” after the URL showing in your browser’s address bar.
After that, you’ll be able to see your .htaccess file. Now, you can edit it. To edit your .htaccess file, highlight it and then click on Code Editor and then you can add your rules to it.
Note: Back up your site before editing your hypertext access file so you can revert back to working version if something goes wrong. Also, you can download .htaccess file to your machine and then you edit. After editing your file delete existing .htaccess file from your root directory and upload new one. You can make two copies of your .htaccess file. This way you can use one as backup and one for editing.