.htaccess is a configuration file that affects how a web server responds to requests.

It is how Apache handles configuration changes on a per-directory basis and a way to configure the details of your website without needing to alter the server configuration files

With .htaccess files, you can override some global configuration settings of .htaccess directives higher in the directory tree.

On most file systems, filenames that begin with a dot ( . ) are hidden files.

This means they are not typically visible by default.

 

WARNING

A .htaccess file can be quite fickle and is something dangerous to play with.

It is one of the reasons why it is a hidden file so you don't accidentally make changes on it that will either affect a server or your website.

A simple typo, space, a wrong or misplaced rule is not about cPanel htaccess not working.

A mistake in your .htaccess file will break your website.

Before editing or making changes to an existing .htaccess file, it is highly recommended that you make a backup of the .htaccess file before proceeding.

Copy and rename the existing file to something like "old_htaccess.txt".

That way if you bork your website, you can simply delete the file, rename "old_htaccess.txt" to .htaccess and all will be well with the world.

Additionally, the placement of the .htaccess file is important.

The configurations in that file will affect everything in its directory and the directories under it.

If you are not comfortable making changes to .htaccess files, please contact a website developer.

Again, extreme caution must be taken when editing this file and if you are not sure what to do, please avoid touching this area of your hosting account.

How To Find Your .htaccess File in cPanel

If you are wondering why there is no htaccess file in cPanel, don't fret about it.

The .htaccess file is located in your public_html directory when it has been created and is not hidden.

To make it visible (if it exists), simply:

Log into cPanel.

Click File Manager located in the Files category.

A new window will open.

If there no .htaccess file in your public_html, click on the File Manager "**Settings**".

Tick the Show Hidden Files (dotfiles).

Click Go.

Look for the .htaccess file in the list of files if one has been created manually or by an application you installed.

 

How To Create A New htaccess File

If you will be installing an application on the website, you don't need to create .htaccess file since our 1-click application installer will do that for you automatically.

If you are using cPanel, all you need to do is to log in to your cPanel server and look for Softwares  >>> Softaculous.

This will take you to another page where you can choose from over 430+ applications and install it with a click of a button.

You can create the .htaccess file in a text editor.

But if you are not yet ready to start using the domain as a website or want to upload your own files, you can create the .htaccess file in a text editor.

If you are doing it locally, name it only htaccess.txt and then upload it to your site through an FTP client or terminal.

Once there, you can then rename it to .htaccess.

In cPanel. simply access cPanel's File Manager.

Look at the top and you will see "File" with a "+" sign.

Make sure you are in the directory where you want the .htaccess file to be and then click on "File".

Type in ".htaccess" and save.

That's it.

You now have a new .htaccess file to configure.

 

Cloudflare & .htaccess File

If you've enabled Cloudflare either through our cPanel or Plesk control panels, your site must use the 'www' sub-domain. 

So please ensure that your .htaccess file does not have any redirects to the non-www version of your URL because you will end up with  'Too many redirects' error in your browser if you do.

 

If there is none, please click on Files.

Then type in .htaccess and then save.

The best way to use your hosting account is to use the Softaculous 1-Click Application Installer and it will handle all aspects of your website installation.

If you, however, have existing files, you can either upload those to the public_html or overwrite the existing files with it.

Kas see vastus oli kasulik? 0 Kasutajad peavad seda kasulikuks (0 Hääled)