404 redirect wp-login and wp-admin after changing login url
Question
I’ve successfully changed the login page to a custom url, using this codes:
This one into wp-config.php
define('WP_ADMIN_DIR', 'secret-folder');
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR);
This one into functions.php
add_filter('site_url', 'wpadmin_filter', 10, 3);
function wpadmin_filter( $url, $path, $orig_scheme ) {
$old = array( "/(wp-admin)/");
$admin_dir = WP_ADMIN_DIR;
$new = array($admin_dir);
return preg_replace( $old, $new, $url, 1); }
This one .htaccess
RewriteRule ^secret-folder/(.*) wp-admin/$1?%{QUERY_STRING} [L]
Now i’m able to login throught /secret-folder/, but i’m still able to login throught both wp-login.php and wp-admin.
I can i redirect those pages to a 404 page?
0
htaccess, login, security, wp-admin, wp-config
3 years
2020-08-20T14:10:40-05:00
2020-08-20T14:10:40-05:00 0 Answers
55 views
0
Leave an answer