wp-admin » How to Rename wp-login.php

How to Rename wp-login.php

It is generally not recommended to rename the wp-login.php file in a WordPress installation as this can cause issues with the WordPress site and may make it difficult or impossible to log in to the WordPress administration panel.

However, if you still want to rename the wp-login.php file, you can do so by following these steps:

  1. Rename the wp-login.php file to the new name that you want to use.
  2. Open the wp-config.php file in a text editor and find the following line:
define('LOGIN_PAGE', 'wp-login.php');
  1. Replace wp-login.php with the new name of the wp-login.php file.
  2. Save the changes to the wp-config.php file.
  3. Open the .htaccess file in the root directory of your WordPress installation, and find the following lines:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
  1. Add a new line before the RewriteRule line to redirect requests for the old wp-login.php file to the new login page:
RewriteRule ^wp-login\.php$ /new-login-page-name [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
  1. Save the changes to the .htaccess file.

After making these changes, you should be able to log in to the WordPress administration panel by going to http://yoursite.com/new-login-page-name. However, keep in mind that renaming the wp-login.php file can cause issues with your WordPress site, and it is generally not recommended to do this.

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

Recommended