0

If I call the .htaccess file in the browser e.g. https://www.mycompany.com/.htaccess, then it is getting downloaded. Is there a way to fix this?

I added this block to my .htaccess file, but it does not help:

<Files "\.htaccess">
    Order allow,deny
    Deny from all
</Files>

This is obviously a security hole.

2
  • Doesn't your htaccess file has 0644 permission ? Commented Oct 26, 2018 at 8:09
  • @ShashankKumrawat, it has -rw-r--r-- (644)
    – Black
    Commented Oct 26, 2018 at 9:08

2 Answers 2

0

Please use this Code spinnet

<Files .htaccess>
    order allow,deny
    deny from all
</Files>

Do not use <Files "\.htaccess">

0

I solved it with this code:

<Files .htaccess>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.