Create a new htacess file in cpanel

Here's a step-by-step guide to creating a new.htaccess file in cPanel:

Prerequisites:

  1. You have a cPanel account and are logged in to it.
  2. You have a domain or subdomain for which you want to create a.htaccess file.

Steps:

  1. Log in to your cPanel account and navigate to the "Files" section.
  2. Click on the "File Manager" icon.
  3. In the File Manager, navigate to the directory where you want to create the.htaccess file. For example, if you want to create a.htaccess file for your root directory, click on the "public_html" or "www" directory.
  4. Click on the "Create New File" button.
  5. In the "Create New File" window, enter the following details:
    • File name:.htaccess (make sure to include the dot at the beginning)
    • File type: Text File
    • Encoding: UTF-8
  6. Click the "Create" button to create the new file.
  7. Once the file is created, you can edit it by clicking on the "Edit" button next to the file name.
  8. In the editor, you can add your desired.htaccess rules. For example, you can add the following code to enable mod_rewrite:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.html$ - [L]
    RewriteCond %{REQUEST_FILENAME}!-f
    RewriteRule. /index.html [L]
    </IfModule>
  9. Save the changes to the.htaccess file.

Tips:

That's it! You have now created a new.htaccess file in cPanel.