top of page

What is htaccess? why say htaccess master is game master

1. What is htaccess?

When encountering a new or confusing problem, I often go online to search for information with questions like "what is it?" and “why to use it”,…. The same goes for htaccess, when I first learned about it, I also read through a lot of tutorials, but most of them I see that they all give a way to write htaccess without specifying why it is and why it should be used. it, well, I think they wrote it, I also understand it briefly, also know how to write it, also know that it has functions such as rewrite url, security, etc. But it is rare to see an article that can answer Thoroughly, thoroughly for me the question that I always wondered in my head “What is .htaccess?” and “why use .htaccess?”. Then I remember a saying, please share useful content, help Bitcoin investors at primexbt learn more new knowledge.



Give a person a fish, they will eat it all today. But teach them how to fish, they'll eat fish for life


Indeed, in this article, I will write the most concise, to give you the simplest and easiest to understand view of .htacess. First, let's analyze what .htaccess is? Extract a definition from wiki


A .htaccess (hypertext access) file is a directory-level configuration file supported by several web servers, that allows for decentralized management of web server configuration. They are placed inside the web tree, and are able to override a subset of the server's global configuration for the directory that they are in, and all sub-directories. (wikipedia)


Here roughly translated means that .htaccess (hypertext file) is a directory-level configuration file supported by some web servers, allowing decentralized configuration of the server (web server). . It is located inside the site's directory tree and has the ability to overwrite the configuration on the current directory and all subdirectories within it.


.htaccess provides a series of directives that directly affect the configuration of the server core (Apache) without having to go inside the system to edit the server config files ( httpd.conf ), which have images extremely important influence on the entire website system running. That's why it's not an exaggeration to say "Master the htaccess, master the game"


It is thanks to the importance and availability of .htaccess that hosting companies share the server environment. Anyone who has ever worked as a hosting provider will know that they will not allow customers to directly access important configuration files inside the system that affect the entire server. Instead, they will let the customer manipulate the .htaccess file and configure the working environment in the current folder containing their own website.


So what can core system configuration files like httpd.conf do, .htaccess can do? The answer is no? Configurations and permissions in .htaccess will be limited by the httpd.conf file itself. This will help system administrators and hosting companies prevent people from trying to configure the .htaccess file to damage the system.


2. Enable .htaccess

To be able to use the .htaccess file and configure permissions, rewrite urls, etc., you must first enable the .htaccess file header in the main configuration file, httpd.conf.


Find in httpd.conf file the following line and remove the comment code "#" to enable .htaccess


# allow .htaccess to have full power :)

AllowOverride All


3. Limit overriding of .htaccess

Here is a simple example showing us that the httpd.conf file affects the ability to overwrite the .htaccess file as discussed above.


# Only allow .htaccess to have authority to assign permissions, indexing

AllowOverride AuthConfig Indexes

What can .htaccess do?

a ) Linked rewrite capability (url rewrite)

It can be said that, when we mention .htaccess, we refer to the familiar phrase "mod_rewrite", it allows us to rewrite the website path so it is friendly, used for many purposes, of which the main purpose I often see it as enhancing web SEO capabilities.


Here I would like to introduce to you some ways to rewrite the path commonly used in .htaccess


a.1) .htaccess file will redirect the path

a.2) Convert all roads ending in .php to .abc

a.3) Move all posts

a.4) Redirect the 404 error website to an error page

a.5) Domain Redirect

a.6) Secure with .htaccess and .htpasswd


You must first create a file, name it .htpasswd, then go to http://www.htpasswdgenerator.net/ , follow the instructions to generate the code, then copy the code to the .htpasswd file . Place this file in your web path (note, you can place it anywhere in your website folder)


Continue, in the .htaccess file add this line

Hint: Are you new and want to learn about Bitcoin but don't know where to start? Watch now Bitcoin Investment Guide, Primexbt trading guide for newbies!

Comments


Hi, thanks for stopping by!

I'm a paragraph. Click here to add your own text and edit me. I’m a great place for you to tell a story and let your users know a little more about you.

Let the posts
come to you.

Thanks for submitting!

  • Facebook
  • Instagram
  • Twitter
  • Pinterest
bottom of page