Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

14
  • 27
    if you have full control of the server is better if you put the config into a directory directive into the virtual host config file. Apache read it only once on startup, .htaccess is read on every access and slow down the server Commented Jan 3, 2009 at 19:43
  • 23
    It'd be nice to have an example .htaccess file as part of this answer. Commented Jun 5, 2012 at 11:47
  • 8
    <Files ~ "\.inc$"> Order Allow,Deny Deny from All </Files> Commented Sep 27, 2012 at 16:53
  • 12
    @James: Also, not everybody feels that Stack Overflow should be a "plz send teh codez" site. If it answers the question clearly, then it is a good answer. Providing an example where none is needed only encourages copy-and-paste coding. Commented Sep 10, 2013 at 21:03
  • 4
    I tried this and if you do Deny from all it won't even work in an include, it will 404. Commented Jul 3, 2017 at 9:53