Changing your WordPress login URL is one of the simplest ways to improve security.
By default, attackers know the standard login path /wp-login.php or /wp-admin.
Hiding or changing this URL helps reduce brute-force attacks and bot traffic.
In this guide, you will learn the best plugin-free method to change your login URL using the
.htaccess file.
This method is lightweight, reliable, and works on most Apache hosting environments including shared hosting,
cPanel, and local servers like WAMP or XAMPP.
Why Change the WordPress Login URL?
- Improve website security
- Reduce brute-force login attempts
- Hide default login endpoint
- No plugin required
- Better performance and fewer attack logs
Best Method: Change Login URL Using .htaccess
This method creates a custom login URL while blocking the default one.
It is safe, fast, and survives theme updates.
Example
Default login URL:
https://yourwebsite.com/wp-login.php
New login URL:
https://yourwebsite.com/securelogin
Step 1 — Backup Your .htaccess File
Before making changes, always create a backup. This allows quick recovery if something goes wrong.
.htaccess
.htaccess-backup
Step 2 — Open the .htaccess File
You can find the file in your WordPress root directory:
public_html/.htaccess
If you do not see the file, enable Show Hidden Files in your file manager.
Step 3 — Add This Code at the Top
Paste the following code above the line:
# BEGIN WordPress
Add this configuration:
RewriteEngine On
# Custom login URL
RewriteRule ^securelogin/?$ wp-login.php [L]
# Block default login URL
RewriteCond %{THE_REQUEST} \\s/wp-login\\.php [NC]
RewriteRule ^wp-login\\.php$ - [R=404,L]
Step 4 — Save the File
Once saved, your new login URL will be active immediately.
https://yourwebsite.com/securelogin
Test Your New Login URL
- Open your browser
- Visit your new login URL
- Confirm the login page loads
- Try the old login URL and verify it shows a 404 error
Recovery Method (If You Get Locked Out)
If you cannot log in, simply remove the added rules from your .htaccess file.
RewriteRule ^securelogin/?$ wp-login.php [L]
RewriteCond %{THE_REQUEST} \\s/wp-login\\.php [NC]
RewriteRule ^wp-login\\.php$ - [R=404,L]
Save the file and your default login URL will work again.
Optional Security Improvement
You can also disable XML-RPC to reduce attack attempts:
# Disable XML-RPC
<Files xmlrpc.php>
Order Deny,Allow
Deny from all
</Files>
wp-login.php file.WordPress updates may overwrite changes and break your site.
Conclusion
Changing your WordPress login URL without a plugin is a simple yet effective security improvement.
Using the .htaccess method keeps
your site lightweight while reducing automated attacks.
This technique works on most hosting environments and is safe for production websites when implemented
correctly.