How to find and create the .htaccess file

.htaccess is a hidden text file that contains additional configuration for websites hosted on Apache (and LiteSpeed) server. With .htaccess file you can create redirects, password-protect directories, block IPs and much more. For some examples on .htaccess files make sure to check this .htaccess Cheatsheet.

On cPanel after you login to the File Manager click on the Settings button in top-right corner, then select “Show Hidden Files (dotfiles)”, save and navigate to your website root directory.

enable dotfiles in cpanel file manager

If there is no .htaccess file present you can create one as any other file in File Manager:

create new file in cpanel file manager

Here is an example: Default .htaccess file for WordPress:

# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Was this post helpful?

Leave a Reply