How to modify the .htaccess file?
The .htacceess files provide the way to perform the configuration on a per-directory basis. In this article, we will cover how to modify the .htaccess files on cPanel, DirectAdmin, and using SSH. Let’s get started!
Using cPanel
1. Log in to cPanel using Username & Password. i.e; (https://yourdomain.com:2083 or https://yourdomain.com/cpanel)
2. Navigate and open Files → File Manager.
3. Navigate to public_html.
4. Select the .htaccess file → Click on Edit. If you cannot find the .htaccess file, that is probably because the “Show Hidden File” option must be disabled. To enable the hidden files, follow this article.
5. In another tab, the editor will open, enabling the access to edit the .htaccess file. Once the required changes are made, click on SAVE.
Using DirectAdmin
1. First, to login into DirectAdmin control panel visit,
https://your-domain.com:2222 or https://IP-address:2222 or https://server-hostname:2222.
2. Navigate to System Info & Files → File Manager.
3. Navigate to public_html.
4. Select the .htaccess file → Click on Edit.
5. Once the changes are made, click on Save File.
Using SSH
Except GUI method SSH method requires slight SSH knowledge to perform the modification in .htaccess file. In this sectiom, you will learn about to how to view/edit dot/hidden files using SSH.
To view hidden/dot files using following command,
ls -a
To edit the .htaccess file you can take the help of any text editor (vi, vim, nano, etc.). For this article, we will use vi text editor,
vi .htaccess
To save the changes and exit, Press Esc → type :wq! (w= write, q=quit, !=force).
Conclusion
Now that we’ve gone over how to modify the .htaccess file using cPanel, DirectAdmin, and SSH. This one-stop article will guide you through the step-by-step procedure to modify the .htaccess file.
KnownHost offers 365 days a year, 24 hours a day, all 7 days of the week best in class technical support. A dedicated team is ready to help you with requests should you need our assistance. You’re not using KnownHost for the best web hosting experience? Well, why not? Check with our Sales team to see what can KnownHost do for you in improving your web hosting experience.