I have two .htaccess files, why?

Avatar
  • Answered
I have an .htaccess file in root (which appears to hold my g_zip browser compression) and also another .htaccess file in my Public HTML directory, which appears to have PHP initialization comments. My question is, should there be two .htaccess files? If the answer is yes, which .htaccess file do I add Apache mod_expires to? I'm not an experienced server administrator, and want to be sure before proceeding. Thanks Jack
Avatar
IMH Support Agent 5
Hello,

Thank you for your question regarding .htaccess files and different directories. In answer to the first question about two or more files, it should be fine if the rules do not cause conflicts. Should there be any conflicts, you should quickly be able to identify the source and move the code elsewhere, or comment out the lines of another file.

For the mod_expires module I advised placing those directives in the .htaccess file alongside your live website files. In this case this would mean the public_html directory.

Best,
Christopher M.