I am interested in:
- how can we change the default login url
/wp-admin
to/login
- how can we add another url for login so that both
/wp-admin
and/login
would work
I tried to use a custom filter and .htaccess as in the following example but without success.
functions.php
add_filter('admin_url', 'my_new_admin_url');
function my_new_admin_url()
{
return '/login/';
}
.htaccess
Redirect permanent /wp-admin/ /login/
another option – redirect
/admin/
towp-login.php
with aparse_query
action hook:EDIT
Well the above apparently only works with certain permalink structures. Here’s another method hooked to
parse_request
:I use just this at the top of my .htaccess file:
RewriteRule ^login/?$ /wp-login.php [NC,L]
or the following, case WordPress resides in a folder, and the rule refers to the root:
RewriteRule ^login/?$ /wp/wp-login.php [NC,L]
I’ve seen [QSA,L] used instead of [NC,L], but don’t know the difference…
Reference: http://planetozh.com/blog/2011/01/pretty-login-url-a-simple-rewrite-api-plugin-example/