BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

How to prevent access to .htaccess – Make it more secure

By Chaitanya Singh | Filed Under: WordPress

This is our another tutorial on .htaccess in order to make your blog more secure. In this tutorial, we will see how to prevent access to .htaccess file. This is one of highly sensitive file, which should not be accessible to anyone else except you. There are two things which you can do to make it inaccessible –

1) Make it inaccessible by adding below piece of code –

[code]
# Add this code to your .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
[/code]

After adding above statements to your file, now the file is safe. Any attempts to access this file would led to 403 error.

2) Change the permissions of the file to 644 as shown below – Login to your cpanel, locate the .htaccess file and change access permissions.

prevent access to .htaccess

.htaccess-change-permissions-to-644

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2012 – 2022 BeginnersBook . Privacy Policy . Sitemap