How htaccess works when using cPanel and addon domains

When you have cPanel hosting and you are using addon domains, domains are "hosted" in a folder in a folder public_html

(by default), for example:

A) public_html/.htaccess
B) public_html/addondomain_1/.htaccess
C) public_html/addondomain_2/.htaccess

      

I understand that whatever I put in the htaccess file A) refers to everything inside it, which should include B) and C).

So, as an example, adding a blocked IP address to A) will also be blocked on B) and C).

But I'm asking this because B) and C) are different domains when viewed in a browser. I tried testing it but without a lot of luck and going through the documentation pages didn't help me come to a conclusion.

If I block IPs in A), will it block them from B) and C) websites?

+3


source to share


1 answer


The Apache docs are pretty self explanatory:

The configuration directives found in the .htaccess file are applied to the directory where the .htaccess file is located and to all of its subdirectories. However, it is also important to remember that the directories may have had .htaccess files. The directives are applied in the order in which they are found. Therefore, a .htaccess file in a specific directory can override directives found in .htaccess files found above in the directory tree. And those, in turn, can have overridden directives found even above, or in the server configuration file itself.



This is a feature of Apache, not cPanel. It doesn't matter if you're using cPanel or not - Apache will still navigate parent directories and apply its directives .htaccess

.

+1


source







All Articles