htaccess for a better wordpress login URL

Adding this rewrite rule to your .htaccess file in the root directory of your wordpress install will change your login url from www.wpsnipp.com/wp-login.php to www.wpsnipp.com/login/ This is also a great snippet to simplify things for your clients. I have found many continue to forget the /wp-login.php url of the wordpress login screen.

RewriteRule ^login$ http://website.com/wp-login.php [NC,L]

Comments  Leave a Reply

  1. TourKick, Clifford P July 25, 2012 at 8:47 am

    I didn’t test it myself, but how would the function work with define(‘FORCE_SSL_LOGIN’, true); (i.e. with HTTPS)?

    1. should not affect anything, but keep a backup of your htaccess and test things out to make sure.

  2. my website url redirect not working any help

    1.  If you have issue with htaccss you can use this plugin to do the same.

  3. Didn’t work for me. Did I need to put it before or inside the #begin WordPress comment tags?

    1. Hi Jerry, if you have problems getting this running you can try this plugin to do the same.  http://planetozh.com/blog/2011/01/pretty-login-url-a-simple-rewrite-api-plugin-example/

  4. nice one…

    1. Cool glad you like it.

  5. Simpler WordPress login url | WordPress Crunch May 18, 2011 at 11:20 am

    […] to Kevin Chard for the cool […]

  6. WordPress login page simplified April 28, 2011 at 10:56 am

    […] link: Better WordPress login #dd_ajax_float{ background:none repeat scroll 0 0 #FFFFFF; border:1px solid #DDDDDD; float:left; […]

  7. I couldnt get this to work in the way you describe, it will redirect…


    But not…


    Notice the trailing slash. After a bit of fiddling I found that adding ?/? to the rule would allow for an optional slash…

    RewriteRule ^login?/?$ http://website.com/wp-login.php [NC,L]

    Im not mod_rewite expert, but this does seem to work as expected now. Hopefully you’ll find this helpful 🙂

    1. Hi Dale, are you sure you have everything correct? because to do a redirect we would need to be using a R flag for redirect. If you are having problems ozh has a wordpress plugin that should help.


      1. Not sure if I meant redirect, I think I should have said “rewrite”. My point was that to be consistent with the way WordPress rewrites its permalinks, when I tried your example I thought it should also allow for an optional trailing slash.

        In fact, unfortunately my example above is slightly incorrect, according to the mod_rewrite docs at apache.org…


        … we can use the quantifier “?” (0 or 1 occurrences of the preceding text) to allow for an optional slash. See the following example…

        RewriteRule ^login/?$ http://website.com/wp-login.php [NC,L]

        Thanks for the link by the way. The Ozh plugin does actually use the same rule given in my example, wish I had read their page before posting my first comment!

        Thanks Kevin, yoru site is a goldmine 🙂

      2. No problem Dale glad you got things sorted out. Goldmine! That is nice to hear, glad you enjoy the site.

  8. Simplifier l’URL de votre page de login Wordpress | Un Blog Presque Parfait March 20, 2011 at 5:27 am

    […] Via : Lien […]

  9. Nice one Kevin!

    1. Thanks Christopher, glad you liked it.

      1. Derek Herman May 2, 2011 at 1:20 pm

        Just use:

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

  10. Simpler WordPress login url March 17, 2011 at 9:52 am

    […] to Kevin Chard for the cool tip! If you enjoyed this article, please consider sharing it! tweetmeme_style = […]

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!