How to Change WordPress Login URL – (3 Easy Ways)

Change WordPress Login URL

QUICK SOLUTION

To change your WordPress login URL, you can either use a plugin like “WPS Hide Login” or manually edit your site’s files. Here’s a quick guide to doing it manually:

  1. Backup Your Site: Always create a backup before making changes.
  2. Edit WP-Login.php:
    • Rename WP-Login.php to a new name.
    • Replace all instances of wp-login in the file to your new URL.
  3. Update Functions.php:
    • Add hooks for logout and password reset to direct them to the new URL.
  4. Test Your New URL: Make sure the new login URL works by logging in.
  5. Edit .htaccess (Optional):
    • Add a rule to rewrite the old login URL to the new one for security.

Alternatively, use a security plugin like “WPS Hide Login,” which provides a simple interface to change the URL without editing files directly.


Lets dive into details now…….

WordPress is the most popular Content Management System (CMS) used by millions of users worldwide. However, its default login URL is vulnerable to brute-force attacks and hacking attempts. Therefore, changing the WordPress login URL is crucial to enhancing website security. In this article, we will discuss why you need to change the WordPress login URL, methods to change the login URL, best practices to follow, and frequently asked questions related to changing wp-admin login URL.

Why Change WordPress Default Login URL?

The WordPress login URL is the gateway to your website’s admin panel. WordPress default login URL is your domain name followed by “/wp-admin” or “/wp-login.php.” However, this WordPress admin login URL is susceptible to brute force attacks, wordpress hacking attempts, and spam login attempts. Hackers use automated bots to scan for WordPress websites and try to guess the login credentials using different username and password combinations. By changing the login URL, you can prevent these automated bots from reaching the login page, making it difficult for them to guess your login credentials.

Moreover, changing the login URL can help you protect your website from targeted attacks. Hackers can identify your WordPress website’s vulnerabilities by scanning your website’s source code, including the default login URL. Changing the login URL makes it difficult for hackers to target your website, thus enhancing your website’s security.

How to Change the WordPress-admin Login Page?

Changing the WordPress login page URL can be a very effective way to enhance the security of your WordPress site. The default WordPress login URL is well-known and easily accessible, making it a prime target for malicious attacks, including brute force attacks. By changing the URL to something unique, you can make it harder for hackers and other malicious actors to gain unauthorized access to your website.

WordPress-admin Login Page

There are a few ways you can change the WordPress login URL, including using a plugin or manually editing your site’s code. If you are not comfortable with editing your site’s code, using a plugin is the easier option. There are several plugins available in the WordPress repository that can help you change the login URL. One of the most popular ones is WPS Hide Login, which allows you to change the login URL to anything you want.

If you prefer to manually edit your site’s code, you can do so by adding some code to your site’s .htaccess file. This file controls the configuration of your web server and can be accessed through your site’s file manager or an FTP client. The code you need to add will depend on the new login URL you want to use. It’s important to note that any errors in your code can cause your site to break, so it’s best to make a backup of your site before making any changes.

Change WordPress Admin Login URL Without Plugin

If you are capable of manually changing the WP-admin URL, you can use the following methods to do so: modifying the WP-login.php file, using the login_URL filter hook, or changing the login URL using the .htaccess file. We will discuss each method in a step-by-step manner below.

Change the WordPress Login URL Using the WP-Login.php File

The first method involves renaming your WP-Login.php file and replacing all references of wp-login with your new login URL. Follow the steps below to change your WordPress login URL using the WP-Login.php file:

  • Step 1: Ensure You Have a Backup of WP-Login.php

Before making any changes to your WordPress login URL, it’s essential to create a backup of your WP-Login.php file. This will ensure that you can easily restore your site in case something goes wrong.

  • Step 2: Rename the WP-Login.php File

To rename your WP-Login.php file, you’ll need to log in to your site via FTP or cPanel File Manager. Once you’re logged in, navigate to the wp-admin folder in your WordPress installation directory. Look for the WP-Login.php file, right-click on it, and select Rename. Next, rename the file to your desired login URL. For example, you can rename it to mynewlogin.php or login.php. Make sure to keep the .php extension.

Rename the WP-Login.php File

  • Step 3: Replace All References of wp-login

Once you’ve renamed your WP-Login.php file, you’ll need to replace all references of wp-login with your new login URL. To do this, you’ll need to open the renamed WP-Login.php file using a code editor.

Replace All References of wp-login

Next, use the search and replace function to replace all instances of wp-login with your new login URL. Make sure to replace all instances, including those in comments and strings.

Replace All References of wp-login

  • Step 4: Upload Your New WordPress Login File

After you’ve made the necessary changes, save the renamed WP-Login.php file. Then, upload it to your WordPress installation directory, overwriting the old WP-Login.php file.

Upload Your New WordPress Login File

  • Step 5: Add Logout & Lost Password Filter Hooks to Functions.php

To ensure that the logout and lost password functions work correctly, you’ll need to add some filter hooks to your functions.php file. These hooks will tell WordPress to use the new login URL for these functions.

Add the following code to your functions.php file:

function my_logout_page() {
 wp_redirect( 'https://www.yoursite.com/logout' );
 exit();
 }
 add_action('wp_logout','my_logout_page');

function my_lostpassword_page() {
 wp_redirect( 'https://www.yoursite.com/lost-password' );
 exit();
 }
 add_action('lostpassword_url','my_lostpassword_page');

Make sure to replace https://www.yoursite.com/ with your new login URL.

  • Step 6: Test Your New Login URL

Once you’ve completed all the above steps, it’s time to test your new login URL. Simply go to your new login URL in your browser and try to log in to your site. If everything is working correctly, you should be able to log in without any issues.

  • Step 7: Delete the Old wp-login File From Your Website

After you’ve confirmed that your new login URL is working correctly, you can delete the old WP-Login.php file from your site. This will help to ensure that your site remains secure and less vulnerable to attacks.

Login_URL Filter Hook

Another way to change the WordPress login URL is to use the Login_URL filter hook. This method is relatively easy and doesn’t require any file renaming or editing. Instead, you can use a simple filter function to change the login URL.

  • Step 1: Add Code to Functions.php File

First, open your website’s functions.php file. You can access this file by going to Appearance > Theme Editor > functions.php. Alternatively, you can access the file through an FTP client like FileZilla.

Once you have the functions.php file open, add the following code snippet to it:

function custom_login_url() {
 return 'http://www.yournewloginurl.com';
 }
 add_filter('login_url', 'custom_login_url');

In the code above, replace http://www.yournewloginurl.com with your desired login URL. Make sure to keep the single quotes around the URL.

  • Step 2: Save Changes

After you have added the code to the functions.php file, save the changes.

  • Step 3: Test Your New Login URL

To test your new login URL, log out of WordPress and visit the new URL. You should be redirected to the WordPress login page.

  • Step 4: Add Logout & Lost Password Filter Hooks to Functions.php

If you want to change the URL of the logout and lost password pages as well, you can use the following code snippets:

function custom_logout_url() {
 return 'http://www.yournewlogouturl.com';
 }
 add_filter('logout_url', 'custom_logout_url');

function custom_lostpassword_url() {
 return 'http://www.yournewlostpasswordurl.com';
 }
 add_filter('lostpassword_url', 'custom_lostpassword_url');

Replace http://www.yournewlogouturl.com and http://www.yournewlostpasswordurl.com with your desired URLs.

  • Step 5: Save Changes

After you have added the code for the logout and lost password URLs to the functions.php file, save the changes.

  • Step 6: Test Your New URLs

To test your new URLs, log out of WordPress and try accessing the logout and lost password pages. You should be redirected to the new URLs.

Change the Login URL Using the .htaccess File

The .htaccess file is a powerful file used to configure Apache web servers. By editing this file, you can change various settings, including the login URL of your WordPress site. However, before editing this file, make sure to create a backup to avoid any accidental damage.

  • Step 1: Access Your .htaccess File

To access your .htaccess file, you can use an FTP client like FileZilla or access it through the cPanel file manager. The file is typically located in the root directory of your WordPress site.

  • Step 2: Add Code to .htaccess File

Once you have the .htaccess file open, add the following code to the file:

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteRule ^my-login-url/?$ wp-login.php [L]

</IfModule>

In the code above, replace my-login-url with your desired login URL. Make sure to keep the question mark and slash at the end of the URL.

  • Step 3: Save Changes

After adding the code to the .htaccess file, save the changes.

  • Step 4: Test Your New Login URL

To test your new login URL, log out of WordPress and visit the new URL. You should be redirected to the WordPress login page.

  • Step 5: Add 301 Redirects

If you have existing links to your old login URL, you should add 301 redirects to redirect them to the new URL. This is important to maintain the SEO value of those links and prevent 404 errors on your website.

To do this, you can add the following code to your .htaccess file:

# Redirect old login URL to new login URL
 Redirect 301 /wp-login.php https://yournewloginurl.com/

Make sure to replace “https://yournewloginurl.com/” with your actual new login URL.

Change WordPress Admin Login URL Using Plugin

There are several plugins available for WordPress that can be used to change the default login URL for the WordPress admin area. Here are a few popular options:

WPS Hide Login plugin

The most popular plugin for this purpose is WPS Hide Login. Follow the steps below to change the WordPress login URL using the WPS Hide Login plugin:

WPS Hide Login Plugin

  • Step 1: Install and Activate the Plugin

Log in to your WordPress admin panel and go to Plugins > Add New. Search for WPS Hide Login and click Install Now. Once the plugin is installed, click Activate.

  • Step 2: Configure the Plugin Settings

Go to Settings > WPS Hide Login. Enter the new login URL in the Login URL field, such as mynewlogin. Then, click on the Save Changes button to save the new login URL.

WPS Hide Login URL Change

  • Step 3: Test the new login URL

After you have changed the login URL using either method, it’s important to test the new URL to ensure that it’s working correctly. To do this, simply enter the new login URL that you have set up in your browser’s address bar.

If the new login URL is working correctly, you should be redirected to the WordPress login page. However, if you encounter any issues, such as a “404 error” or a “Page Not Found” message, it’s likely that there is an issue with the new login URL. In this case, you will need to troubleshoot the issue by double-checking the steps you followed to change the login URL and ensure that all the steps were completed correctly.

Hide My WP

Here’s a step-by-step process to install the Hide My WP plugin in WordPress and change the wp-admin URL:

  1. Log in to your WordPress dashboard.
  2. Click on “Plugins” in the left-hand menu, then click “Add New.”
  3. In the search bar, type in “Hide My WP” and press Enter.
  4. Find the “Hide My WP” plugin and click “Install Now.”
  5. After the installation is complete, click “Activate.”
  6. In the left-hand menu, click “Hide My WP” to access the plugin settings.
  7. In the “Hide My WP Settings” tab, enable the “Hide Login Page” option.
  8. Enter the new login URL you want to use in the “New Login URL” field.
  9. Click “Save Changes.”
  10. Log out of your WordPress dashboard and test the new login URL by entering it into your web browser.

Better WP Security plugin

Here are the step-by-step instructions to install the Better WP Security plugin in WordPress to change the wp-admin URL:

  1. Log in to your WordPress dashboard.
  2. Click on the “Plugins” tab in the left-hand menu.
  3. Click on the “Add New” button at the top of the page.
  4. In the search bar, type “Better WP Security” and hit enter.
  5. Click on the “Install Now” button next to the Better WP Security plugin.
  6. Wait for the installation to finish, then click on the “Activate” button.
  7. Once the plugin is activated, click on the “Security” tab in the left-hand menu.
  8. Click on the “Hide” tab at the top of the page.
  9. Scroll down to the “Hide Login Area” section.
  10. Check the box next to “Enable Hide Backend”.
  11. In the “New Login URL” field, enter the new URL you want to use for the wp-admin login page.
  12. Click on the “Save Settings” button at the bottom of the page.
  13. Test the new login URL to make sure it’s working correctly.

You have successfully installed and configured the Better WP Security plugin to change the wp-admin URL in WordPress.

Best Practices for Changing the WordPress Login URL

Changing the WordPress login URL can be an effective way to improve the security of your WordPress website. However, it’s important to follow some best practices to ensure that the process goes smoothly and without any issues. Here are some best practices to keep in mind when changing the WordPress login URL:

  • Create a backup before making any changes

Before making any changes to your WordPress website, it’s always a good idea to create a backup. This way, you can easily restore your website to its previous state in case anything goes wrong during the process.

  • Choose a secure login URL

When choosing a new login URL, it’s important to choose a secure and unique URL that is not easily guessable. Avoid using common names like “admin” or “login” as these are frequently targeted by hackers.

  • Update any relevant links or bookmarks

Once you have changed the WordPress login URL, it’s important to update any relevant links or bookmarks that you or your users may have saved. This will ensure that everyone can access the login page without any issues.

Changing the WordPress login URL is a simple and effective way to improve the security of your WordPress website. By following the methods outlined in this article, you can easily change the login URL and make it more secure. Just remember to follow best practices, such as creating a backup and choosing a secure login URL, to ensure a smooth process.


FAQs – Change WordPress admin login URL

What is the best method to change my WordPress login URL?

The best method to change your WordPress login URL is by using a plugin. The WPS Hide Login plugin is a popular and effective option that can help you change your login URL in a few simple steps.

Can changing my WordPress login URL affect my website’s SEO?

Changing your WordPress login URL does not directly affect your website’s SEO. However, it’s important to set up 301 redirects from the old URL to the new URL to maintain the SEO value of any existing links.

How do I know if my new WordPress login URL is working correctly?

You can test your new WordPress login URL by trying to log in to your WordPress dashboard using the new URL. Make sure to test all login methods, such as the default login form, the login widget, and any custom login forms you have set up.

Is it possible to change the WordPress login URL without using a plugin?

Yes, it is possible to change the WordPress login URL without using a plugin. You can follow the steps outlined in the previous sections of this article to change the login URL using the WP-Login.php file or the .htaccess file. These methods do not require the use of a plugin and can be done manually. However, if you’re not comfortable editing code or modifying files, using a plugin may be a better option for you. Ultimately, it comes down to personal preference and the level of expertise you have with WordPress.

24/7 WP Security & Malware Removal
Is your site hacked or infected with malware? Let us get it fixed for you
Secure My Website(s)