Block access to .htaccess

2 Comments

Before I answer the ‘how’, let me answer the ‘why’.

.htaccess, now a days, plays a major role. It lets you re-write URLs, redirect traffic, and if you are really good with it, point people to different scripts on your website. It is also an excellent way to cloak your web space structure.

The problem occurs if someone is able to have a look at your .htaccess file and see how things are processed at the ‘back stage’. Or the reason could be that you have written a state-of-an-art .htaccess file and want those 16 year olds to stay away from it.

Just place this at the top of your .htaccess file and you can sleep peacefully, once again ;)


order allow,deny
deny from all

2 Comments (+add yours?)

  1. Joseph McCullough
    Mar 12, 2010 @ 17:53:37

    I tried to access my .htaccess file, and it already came up with a 403 forbidden message. Maybe it’s a web host’s server preference that determine that. If I come across a provider that doesn’t have .htaccess automatically blocked, I’ll be sure to use this method.

    On a side note, the code text box with the numbers is pretty nice looking, but when I tried to copy the code into my editor, the line numbers were copied too.

    Reply

    • Adeel
      Mar 13, 2010 @ 23:52:17

      I just put it in all my .htaccess files to be safe.

      And I’ve noticed it too, I guess I’d have to write a custom plugin to do the job. Thanks for the heads up.

      Reply

Leave a Reply