Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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>
share|improve this question
2  
Did you test it? –  toscho 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 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 Aug 13 '12 at 5:25
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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