| 开发者 |
clickar
alebuo |
|---|---|
| 更新时间 | 2026年10月14日 23:34 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
.htaccess). Bots and brute force attacks are rejected by the server, so they never reach WordPress, PHP or your database.
Why protect wp-login.php at the server level?
Every request to wp-login.php loads WordPress and queries the database, even when it comes from a bot trying thousands of passwords. Plugins that limit login attempts or add a CAPTCHA still have to do that work for every attempt. With Protect WP Login the server rejects those requests before WordPress starts:
wp-login.php with server-level HTTP Basic Authentication.xmlrpc.php, another common target of brute force attacks.wp-login.php..htaccess support (most shared hosting). On Nginx, the plugin shows the configuration to add to the server./wp-content/plugins/protect-wp-login directory.Plugins like Wordfence or Limit Login Attempts check each login attempt inside WordPress, after it has loaded. Protect WP Login blocks the request at the web server, before WordPress loads, so bots don't use your server resources. You can use both: Protect WP Login is an extra layer in front of your security plugin.
Connect to your site by FTP or with the file manager of your hosting, open the .htaccess file in the WordPress folder and delete the lines between # BEGIN Protect WP Login and # END Protect WP Login. You can also rename the wp-content/plugins/protect-wp-login folder to deactivate the plugin.
It works on Apache and LiteSpeed servers that allow .htaccess files, which covers most shared hosting. After writing the rules the plugin checks your site: if the server answers with an error, the rules are removed automatically and the status panel explains what happened.
Nginx doesn't read .htaccess files. The plugin page shows the configuration you (or your hosting provider) have to add to the Nginx server to protect wp-login.php with the same users.
Yes. Visitors can still unlock password protected posts and pages without knowing the extra credentials.
If you don't use Jetpack, the WordPress mobile app or another service that publishes through XML-RPC, enabling it blocks another common entry point for brute force attacks.
Browsers remember Basic Authentication credentials during the session, and most of them (Chrome, Firefox, Edge, Safari) offer to save them like any other password, so you don't have to type them again.
Go to the 'Protect WP Login' page in the admin menu. Enter a username and password and click 'Save' to add a user, or click 'Delete' next to an existing user. There is always at least one user.
A simple combination is enough to stop bots, because they are blocked before reaching WordPress. The password can't be the same as the username.
Basic Authentication sends the credentials in every request to wp-login.php, just like the WordPress login form. Use HTTPS (free with Let's Encrypt on most hosting) to keep them private.