WordPress Guy

WordPress Guy designs and develops WordPress themes and plugins. WordPress Guy teaches you WordPress stuff.

Sometimes I find it pretty hard to type my WordPress Admin URL… you know “http://blogaddress.com/wp-admin.php” or “http://blogaddress.com/wp-admin/“… that’s too many dashes, points and slashes for my taste :-D.

If your server supports mod_rewrite (most servers do), you can shorten your login URL to just “login” by adding this rewrite directive to the .htaccess file in your blog directory:

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

But wait, if your blog’s permalink structure is set to “pretty” permalinks, then, your .htaccess file has some rewrite rules already, in that case just add the RewriteRule directive right after the “RewriteBase /”. Like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
 
RewriteRule ^login$ /wp-login.php [L]
 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Make sure you save a back-up copy of the original .htaccess file (if there was one) before making these changes. You can never be too careful.

Also, make sure there isn’t a “login” directory.

Comments

  • July 28th, 2008 at 1:00 pm

    Not only for WP bloggers but for all PHP developer, thanks for it

  • October 16th, 2008 at 4:21 pm

    Статеечка на высоте +100

  • ... bien, para complicar algo las cosas, pero de un modo mas geek si se quiere, hace poco leí por ahí un modo de facilitar la entrada a tu blog usando las virtudes de mod_rewrite (si tu servidor la ...

  • January 21st, 2009 at 10:57 pm

    I simply write wp-admin for entering…

  • bmw e36 hater
    February 3rd, 2009 at 4:05 am

    thank u m8 very useful it works perfectly

  • December 14th, 2009 at 8:05 pm

    Works perfectly dude ..
    thanx

  • February 25th, 2010 at 6:11 pm

    This is AWESOME — thank you so much.

    One question: how do you mask the URL when someone logs out? It seems like the addition of the ?loggedout=true breaks the rewrite rule…

  • April 21st, 2010 at 11:38 am

    Thanks mate, this what I was looking for. Very clean a nice example.

  • September 24th, 2011 at 12:49 pm

    thanks for sharing!!! :D

Your Comment