An .htaccess file contains directory-level settings used by Apache, such as redirects and access rules. This guide explains how to create the file in cPanel when your website does not already have one.
Check for an existing file
- Log in to cPanel and open Files > File Manager.
- Open Settings, select Show Hidden Files (dotfiles) and save.
- Browse to the website’s document root. This may be
public_htmlor another directory shown in cPanel’s Domains page. - Look for
.htaccess. If it exists, download a backup and edit the existing file instead of replacing it.
Create the file
- In the required directory, click + File.
- Enter
.htaccessas the filename, including the leading dot. - Check the destination path and click Create New File.
- Select the file and click Edit to add the rules your website requires.
- Save and test the affected pages. If a change causes an error, remove that change or restore your saved copy.

Info
An empty .htaccess file has no effect. Apache must permit the relevant overrides for its rules to work, and NGINX does not read .htaccess files. Do not change permissions to 777 to try to make the file work.