There isn't a single "active"
.htaccess file - it's a little more complex than that. Without knowing how your server is configured or what is actually in these
.htaccess files, we can only assume they are all "active". They all work together.
.htaccess file is an Apache per-directory config file. It affects the directory where the
.htaccess file is located and the entire directory tree below it. Server permitting, all
.htaccess files along the filesystem path (that the URL maps to) are processed, starting with the parent directory and drilling down into subdirectories. So, in your example, the
.htaccess file in the "Root" will be processed before the
.htaccess file in A's
public_html directory - if a file below A's
public_html directory is requested.
However, different modules are processed independently across config files, which isn't necessarily the order in which the directives appear within any single
.htaccess file. And how the directives are "inherited" between parent/child
.htaccess files is also module dependent (mod_rewrite, in particular, has its own rules in this regard).
I assume that these files have to be only on the root oh the public.html. Am I right?
This would be an ideal; for easy maintainance. However, as mentioned above, they can occur anywhere. Depending on what you are doing, it may not even be desirable to have all directives in a common
.htaccess file in the root. But neither should you arbitrarily disperse directives across the filesystem.
If you have access to the server config then you can more easily consolidate all
.htaccess files into a single config (inside a
<VirtualHost> container) - perhaps with multiple
<Directory> containers therein.