Created
July 12, 2023 10:50
-
-
Save svebal/cd6071ecd9bb1a29c241ba7c190509a0 to your computer and use it in GitHub Desktop.
protect wp-debug.log from public access
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Prevent viewing of .htaccess file | |
<Files .htaccess> | |
order allow,deny | |
deny from all | |
</Files> | |
//Prevent directory listings | |
Options All -Indexes | |
<Files debug.log> | |
order deny,allow | |
deny from all | |
allow from 127.0.0.1 | |
</Files> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* in wp-config.php | |
**/ | |
/* Debugging */ | |
define( 'WP_DEBUG', true ); | |
define( 'SCRIPT_DEBUG', true ); | |
define( 'WP_DEBUG_DISPLAY', false ); | |
if ( WP_DEBUG ) { | |
// turn off wordpress debug logging (otherwise it will be overwritten) | |
define( 'WP_DEBUG_LOG', false ); | |
// specify new safe path | |
$path = realpath( $_SERVER["DOCUMENT_ROOT"] ) . '/wp-logs/debug.log'; | |
// enable php error log | |
@ini_set( 'log_errors', 'On' ); // enable or disable php error logging (use 'On' or 'Off') | |
@ini_set( 'error_log', $path ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment