-2

Say my wordpress install is here, example.com/wp/ but my .htaccess is in example.com, am I ok with

<Files wp-config.php>
  Order Allow,Deny
  Deny from all
</Files>

or do I need to specify a directory?

<Files /wp/wp-config.php>
  Order Allow,Deny
  Deny from all
</Files>
  • 2
    Did you test it? – fuxia Aug 12 '12 at 0:52
  • +1 for testing it with a text file (or similar file). I just tested it and my finding is provided below as an answer. – Pothi Kalimuthu Aug 12 '12 at 1:51
  • Frankly, this kind of protection is superfluous - rather than reel off the reasons here, I'll let someone else put it better than I could (different technique, same reasoning). – TheDeadMedic Aug 12 '12 at 9:09
  • @toscho I had tested it, both times I saw just a blank white screen, hadn't thought to just try it with a txt file like Pothi had suggested. Thanks to TheDeadMedic I'm not even going to bother with it any further, but I am curious as to why with my text file experiment I receive 403 forbidden, and for wp-config I just get a white screen? – Chuck Aug 13 '12 at 1:05
  • @Chuck I'd put the white screen issue as a separate question so that the answer to it may help others too. – Pothi Kalimuthu Aug 13 '12 at 5:25
0

Only the first version works...

<Files wp-config.php>
  Order Allow,Deny
  Deny from all
</Files>

As per the current documentation, in <Files filename>, the filename should include a filename, or a wild-card string, where ? matches any single character, and * matches any sequences of characters.

So, specifying path doesn't work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.