Protect Htaccess

Htaccess Protection Code

If somehow the file permissions to your htaccess file has been incorrectly set or if by any chance your server happens to be not as secure as it should be at any time, anybody would be able to view your htaccess file from a standard browser and see passwords, or perhaps any stuff you don't want publicly displayed such as URL rewriting rules, 301 redirects, you name it, they'll be able to see it.

So, to prevent anybody from viewing the .htaccess file in this manner, you can use the following code.