WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can i do this:

Whenever visitors open the login page (wp-login.php), they will be redirected to the mainpage. Only the admin (me) can view the page to login.

I am doing this to protect my wp sites. Is there any better way to protect WP login page?

share|improve this question

You can make it so no one can register by clicking off "Anyone can register" in your Admin.

Furthermore, you can choose a really good password, install a login lockdown plugin and enable logins over https. In most cases this is secure enough.

If your really paranoid you can allow access to only your IP by using .htaccess.

<Files wp-login.php>
    order deny,allow
    deny from all
    allow from (your IP)

To do a re-direct you can try something like this in your .htaccess.

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1 (Your IP)
RewriteCond %{REQUEST_URI} !/wp-login\.php$ 
RewriteRule .* http://www.yourhomepage.com [R=403,L]
# 403 is a "forbidden", you can change this to another status code
share|improve this answer
Actually, i get this idea after i read Dreamhost newsletter. They mention their new website now is built on WP. So i try to put /wp-login.php or /wp-admin at the end of their website's URL but what happen is i am redirected to the mainpage. This is what i want to do. Somehow i think only the admin know what is the right URL to login to the WP address. How to achieve this? – Dzulfriday Sep 20 '11 at 8:55
Updated my answer for a redirect, but in all honestly if you don't know how to do this then you probably don't need to do this. Install a login lockdown plugin instead, who cares if people can reach the login page... – Wyck Sep 20 '11 at 18:12
the plugin is not updated – Dzulfriday Sep 21 '11 at 2:22
wordpress.org/extend/plugins/limit-login-attempts Just because a plugin is not up to date does not necessarily mean it does not work. – Wyck Sep 21 '11 at 3:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.