.htaccess Basic

.Htaccess is a very important topic for web developers. We use .htaccess to make the web site SEO friendly, for security and to solve various problems. Many of us do not understand the search on Google htaccess and use it without understanding and many do not. The chain will be posted with htaccess. Inshallah, you don’t have to use htaccess without understanding. It will also be very helpful for those who do freelancing because there are a lot of marketplace htaccess related jobs available.

A few words about .htaccess

.htaccess is the configuration file used on the Apache webserver. .htaccess is basically an anonymous file, .htaccess is an extension. It is hidden by default. This file is usually in the root directory of the server but can be placed in a subdirectory other than the root.

If you do not see .htaccess by default in cpanel then show Hidden Files (dotfiles) when opening the file manager. Tick ​​the box. If you still don’t see it, create a file called .htaccess.

How to create a .htaccess file

A very simple matter, you can create a .htaccess file directly on Sipnell or create it on your PC and then upload it.

Made directly from cpanel:

Click on cpanel New File and enter the name (.) Dot htaccess then click on Create New File button. Became the .htaccess file.

Made on PC:

Any type of code editor software such as Notepad ++ Sublime Text Brackets (.) Must be saved with the name dot htaccess. We can also do it with the normal Notepad of Windows. When you open Notepad and save, you have to save the file name (.) Dot htaccess with Save as type: All File. The .htaccess file became busy.

How .htaccess works:

Many ask where to put the .htaccess file or when to root it; When to put in a subdirectory. To know the correct solution to this question, you need to know how .htaccess works. Simply put, we compare the way .htaccess files work with CSS. For example, if the font size of the body tag is 14 pixels, then the font size of all the paragraphs, headings or other sub-elements inside this body tag will be 14. Again, if the font size of a dic is used inside that tag, then the font size of all the elements inside that dic will be 18. The .htaccess file works in exactly the same way. If you keep the file in the root, the code of that .htaccess file will also affect the sub-directory in the root. But if you put the .htaccess file in a subdirectory/folder, it will affect the files or subdirectories of that folder.