You are currently viewing How to Create a New .htaccess File Using cPanel’s File Manager

How to Create a New .htaccess File Using cPanel’s File Manager

When managing a website, you might often need to modify its configuration without changing the server settings for everyone else. This is where the .htaccess file comes in handy. It’s a configuration file used by web servers running the Apache software to handle the configuration changes at a directory level. Using the .htaccess file, you can rewrite URLs, manage redirects, control access, and protect your directories, among other things. In this blog, we’re going to guide you through the process of creating a new .htaccess file using cPanel’s File Manager.

This blog is a part of our cPanel server management services where we make sure your cPanel server works efficiently with any issues.

Understanding .htaccess

.htaccess stands for “Hypertext Access” and these files are used to make configuration changes on a per-directory basis. This file is incredibly powerful and can influence the functionality of your site significantly. Common uses include setting up custom error pages, password-protecting folders, or even redirecting users.

Accessing cPanel’s File Manager

To start creating a .htaccess file, you first need to log into your cPanel account. Once you are logged in:

  • Navigate to the File Manager: You can find this tool in the “FILES” section of cPanel. Click on the File Manager icon, which will open the file system of your hosting account.
  • Select the Directory: Once inside the File Manager, you need to navigate to the directory where you want to create the .htaccess file. If you are looking to apply settings to your entire website, navigate to the public_html directory.

Steps to Create a New .htaccess File Using cPanel’s File Manager

Step 1: Sign into your cPanel control panel.

Step 2: From the FILES section, select the File Manager option.

Step 3: Navigate to the public_html directory.

Step 4: Enable the display of hidden files via the settings.

Editing an Existing .htaccess File

Step 5: Locate any existing .htaccess file within the public_html directory.

Step 6: Right-click on the .htaccess file and choose the Edit option from the menu.

Step 7: Click the Edit button to open the file.

Now you can make necessary changes to the .htaccess file. Remember to hit the Save button in the top right corner when you’re done.

Creating a New .htaccess File

Follow first 4 steps and then,

Step 5: Select the New File button located in the top left corner.

Step 6: Enter .htaccess in the New File Name field and click on the Create New File button.

Step 7: You can now begin writing or editing your .htaccess file.

Alternatively, you can create the .htaccess file on your local computer and upload it using the file manager.

Troubleshooting Common Issues

If you encounter an error after editing the .htaccess file, it is likely due to a syntax error in the file. Review your file for any typos or incorrect directives. It’s also a good idea to make incremental changes and test frequently, so you can identify exactly what change is causing an issue.


Creating and modifying a .htaccess file in cPanel’s File Manager is a straightforward process once you understand the steps involved. With this powerful tool, you can make specific changes to how your website behaves on the server without affecting other websites hosted on the same server. Always ensure to backup your .htaccess file before making changes, so you can easily revert back if something goes wrong.