When you, a guest or a visitor tries to login to WordPress, they will have to go to a file named wp-login.php, which is located in the main directory of the WordPress installation. It isn’t easy to remember to go to wp-login.php to login to WordPress, so let’s use an .htaccess code snippet or a WordPress function that uses WordPress’s Rewrite API to modify the login URL.From:

http://yourdomain.com/wp-login.php

To:

http://yourdomain.com/login

.htaccess

Add the following to your .htaccess file to change the login URL from wp-login.php to login:

RewriteRule ^login$ /wp-login.php [NC,L]

WordPress Function

Add the following to your theme’s functions.php to change the login URL from wp-login.php to login:

// Redirect login to wp-login.php function wp_login_rewrite() { add_rewrite_rule( 'login/?$', 'wp-login.php', 'top' ); } add_action( 'init', 'wp_login_rewrite' );

On line three (3), you’ll notice 'top', which means top priority. You can set it to bottom if you wish.

It’s important to note that with both code snippets, the login URL will only redirect to wp-login.php.