Hide Your .htaccess Settings Using … .htaccess

By  on  

Your .htaccess file can hold a good amount of information about the structure of your website, some of which should not be exposed to users. These settings include mod_rewrite settings, php_flag/php_value settings, and SetHandler directives.

Luckily, you can use your .htaccess file to hide your .htaccess file. Here's how:

The Code

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

Recent Features

  • By
    5 Ways that CSS and JavaScript Interact That You May Not Know About

    CSS and JavaScript:  the lines seemingly get blurred by each browser release.  They have always done a very different job but in the end they are both front-end technologies so they need do need to work closely.  We have our .js files and our .css, but...

  • By
    Responsive Images: The Ultimate Guide

    Chances are that any Web designers using our Ghostlab browser testing app, which allows seamless testing across all devices simultaneously, will have worked with responsive design in some shape or form. And as today's websites and devices become ever more varied, a plethora of responsive images...

Incredible Demos

Discussion

  1. A better way from the askapache.com htaccess tutorial technically is:

    Order allow,deny
    Deny from all
    

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!