On my site (WP), some php directly accessible, this is one of them example/wp-settings.php
Resulting:
Warning: require(ABSPATHwp-includes/load.php): failed to open stream: No such file or directory in /home1/hidden/public_html/wp-settings.php on line 21
Warning: require(ABSPATHwp-includes/load.php): failed to open stream: No such file or directory in /home1/hidden/public_html/wp-settings.php on line 21
Fatal error: require(): Failed opening required ‘ABSPATHwp-includes/load.php’ (include_path=’.:/opt/php54/lib/php’) in /home1/hidden/public_html/wp-settings.php on line 21
I’ve tried this on .htaccess
<Files *.php>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Files>
<Files index.php>
Order Allow,Deny
Allow from all
</Files>
Blocking direct access but allowing access from server, but this resulting error on my dashboard, many control inaccessible.
I also already tried some other thing similar to this, but none of them worked
I’m not gonna specifically block direct access wp-settings.php
because I’m sure there are others php
files that need to blocked from direct access.
My question, how to block direct access to php, my server able to access php and all WP dashboard control functioning properly
Thanks
Add following line at top of file
wp-settings.php
Restrict All Access to
wp-includes
I added this to my .htaccess:
It seems the only way to answer this question is to simply enumerate all the files in the root that are include files (and surely should be in wp-includes!).
There’s then the problem of what to put in the wp-includes/.htaccess file. I’m still working on that. It should be just a case of denying access to everything, but I suspect it’s not as simple as that – if I remember correctly, doing this kills the editor.