beginnersbook.com

  • Home
  • All Tutorials
    • Learn Servlet
    • Learn JSP
    • Learn JSTL
    • Learn C
    • Learn C++
    • Learn MongoDB
    • Learn XML
    • Learn Python
    • Learn Perl
    • Learn Kotlin
  • Core Java
  • OOPs
  • Collections
  • Java I/O
  • JSON
  • DBMS

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

By Chaitanya Singh | Filed Under: .htaccess

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

Enjoyed this post? Try these related posts

  1. How to prevent directory listing using htaccess
  2. How to create .htaccess file in WordPress
  3. htaccess RewriteRule, mod_rewrite, RewriteCond & Redirect 301
  4. How to edit .htaccess file in WordPress
  5. How to change default directory page using .htaccess file
  6. Redirect subdirectory to root using .htaccess

Leave a Reply Cancel reply

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

SEO

  • Write SEO Articles
  • Open Graph Meta Tags
  • SEO Friendly Images
  • SEOPressor Review
  • Auto Interlink Posts

WordPress

  • Free plugins to add Open Graph Tags
  • Free plugins to add Captcha
  • Set thumbnails automatically
  • Display related Posts WP
  • Change Post excerpt length WP

Website

  • Add Facebook like button
  • Add Google plus button
  • Add Twitter button
  • Create Free Website on blogspot

Copyright © 2012 – 2021 BeginnersBook . Privacy Policy . Sitemap