You are currently viewing .HTACCES, What this file means and how it helps us

.HTACCES, What this file means and how it helps us

You may have heard in many tutorials about a file in the Worrdpress structure called .htacces, but you may not be so interested in finding out what’s good. I will try in this article to explain what this file can help us with and how to access it!

How to access the .htacces file

In order to view this file, you must first make sure that it is visible in your directory. To do this go to the cPanel account, File Manager and in the upper right you will see a button with “Settings”.

Click on that button and in the window that will appear make sure the box with ” Show hidden files (dotfiles) ” is checked. This displays all files in the main folder.

Display HTAcces WordPress file
access hidden files

To view this file, go to Public_HTML (in this folder you will find all the files of the site) and access .htacces

What does HTACCES mean?

This is a file through which certain instructions can be given to the server on which your site is hosted. It is a configuration file for the Apache HTTP server that allows administrators to specify options for individual directories.

This is the abbreviation for HiperText Access and from my point of view it is a very useful tool for programmers who want to perform certain actions on a website.

What exactly can this file help us with?

This file is read by the server and acts according to its rules depending on the folder where it is added to the server. Specifically, if it is added to public_HTML it will follow the instructions in that folder. If it is added in wp-admin it will respect the rules only the respective folder.

What instructions can you give the server through this file?

Extremely many actions can be performed, from compressing some files to blocking access to certain pages. Here are some examples:

You can “tell” the server that up to 50M files can be uploaded by adding the following code in .htacces

php_value upload_max_filesize 50M

You can block access to the wp-config.php file to better secure your files by adding the following code:

<files wp-config.php>
order allow,deny
deny from all

Redirects can be made with the help of this file. Below is an example where / service may be a page you want to redirect to a new domain. More exactly. If you have moved the site from one domain to another domain, to redirect all pages from the old domain to the new one this instruction is more than useful.

# Redirect to a different domain 
Redirect 301 "/service" ""

The examples can go on but don’t forget that you can use it quite easily for what you need every time!

I hope you found this article useful and if you have any questions do not hesitate to send them to the site administrator or to the comments section where we will be happy to answer.

Online media photo created by creativeart –