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
    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...

  • By
    An Interview with Eric Meyer

    Your early CSS books were instrumental in pushing my love for front end technologies. What was it about CSS that you fell in love with and drove you to write about it? At first blush, it was the simplicity of it as compared to the table-and-spacer...

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!