How To Change Your WordPress Login URL

“Usually, the default URLs through which you can log in to WordPress are: yourdomain.com/wp-admin/ or yourdomain.com/wp-login.php/. Now, some of you might want to change that. and you will ask how to do that. let me show the trick for changing login url.
To make your login URL just http://example.com/login just add this line in your .htaccess file before the default WordPress rewrite stuff:.
RewriteRule ^admin$ http://example.com/wp-admin/ [NC,L]
- The carret
^
is a substitute for the directory that the .htaccess file is in. For example if the file is in your root, it stands forhttp://example.com/
. - The dollar sign
$
means “stop matching here” (So ultimately we’re looking forhttp://example.com/login
). - Then after the space you put the URL to use instead. This is our fully valid WordPress login URL, nothing fancy here.
- After that are the [flags]. We are using two:
NC
andL
.NC
means “no case” which means “LoGiN” would match as well as “login”.L
means “last” meaning don’t process any of the rest of the .htaccess file after this match. This is important so our WordPress rewrites don’t get involved. - Note that this doesn’t redirect, it rewrites, which I think is cleaner. If you’d prefer a redirect, you can add an
R
flag as well.