My Preferred Way to Change the WordPress Login URL
This post was translated from Chinese by AI. If anything reads oddly, the Chinese original is authoritative. 中文原文
First, changing the login URL helps prevent brute-force attacks that could make the site inaccessible or drive up CDN traffic. It can also deter people who are just messing around. 1. Rename wp-login.php in the website’s root directory to wp-a.php (or another name; wp-a.php is used in this example), and replace every occurrence of wp-login.php in that file with wp-a.php; 2. Open wp-includes/general-template.php under the root directory. Leave the code at around line 438 unchanged:
$login_url = site_url('wp-login.php', 'login');
Replace every other occurrence of wp-login.php in that file with wp-a.php. Once you have finished editing, save the changes over the original file. This changes the login URL.
Reference article: https://devework.com/modify-wordpress-login-file.html
Last updated 2025-01-14
Comments 0