The most common place to upload an .htaccess file is the root ie. the home page of your website. This is because so many things can be controlled from the top level.
However, there are many occasions when you will need to upload an .htaccess file to a sub directory.
Htaccess Password Protect
For example, if you want to password protect a directory you need to place the .htaccess file in the directory you want to protect.
The important thing to remember is that any code in a subdirectory .htaccess file supercedes the one in the directory above.
However, it only supercedes it when there is a clash. I’ll explain this with an example.
Lets say your root .htaccess and your subdirectory .htaccess file both state how a 404 error should be treated.
If someone tries to view a page which has been deleted within the subdirectory then the user will be redirected according to the rule stated in the subdirectory .htaccess file ie. it supercedes the htaccess on the home page.
If, however, the user tries to view an incorrect url in the root directory, the root .htaccess file will dictate what will happen.