.htaccess » How to find and create the .htaccess file

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.

How to find the .htaccess file

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.

dotfiles 1024x500 1 - How to find and create the .htaccess file
enable dotfiles in cpanel file manager

How to create an .htaccees file

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

new file file manager 1024x500 1 - How to find and create the .htaccess file
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
See also  5 different methods to open all links in new tab on WordPress

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

Recommended