The default URL for logging into your WordPress powered site is:
http://example.com/wp-login.php. Or if you’ve installed in a subdirectory, something like
http://example.com/wp/wp-login.php. I’ve wished that was a little cleaner, especially when you are doing something explaining to a client where to log in over the phone. Fortunately changing this can be very easy.
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 ^login$ http://example.com/wp-login.php [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 for
- The dollar sign
$means “stop matching here” (So ultimately we’re looking for
- 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:
NCmeans “no case” which means “LoGiN” would match as well as “login”.
Lmeans “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
Rflag as well.
Not up for tinkering with .htaccess yourself? Ozh has a plugin based on this post. Easy breezy either way you slice it.