How do I hide Wordpress debug.log from search bots using .htaccess?
i.e: /wp-content/debug.log
Thanks.
I found the answer from another site which Wordfence had hidden for me.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/?wp\-content/+debug\.log$
RewriteRule .* - [F,L,NC]
</IfModule>
<IfModule !mod_rewrite.c>
<Files "debug.log">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
</IfModule>
/? in the RewriteCond line? If we expect the server to not trim / characters before doing the match, it should be /*, to prevent access to example.com///wp-content... etc. If we expect the server to trim them, /? is not needed. I'm also not sure how much adding [NC] to the RewriteRule line helps, if the RewriteCond is case sensitive. Again, if we expect the server to be in case insensitive mode, than RewriteCond should have the [NC] flag. If we expect example.com/wp-content/DEBUG.log to give a 404, than [NC] is not needed on the RewriteRule line.
robots.txt. But this file shouldn't download by all, so you can protect it by auth: htaccesstools.com/articles/password-protection