title: How to redirect user to 404 page not found error when non admin try to access wp-admin or wp-login.php
body: <p>For security reasons I am trying to restrict my wordpress site admin and login panel access to non-admin users by rewriting the link, such that if user types in <a href="http://www.mysite.com/wp-login.php" rel="nofollow">http://www.mysite.com/wp-login.php</a> or <a href="http://www.mysite.com/wp-admin" rel="nofollow">http://www.mysite.com/wp-admin</a> he is redirected to Error 404 page but if he types <a href="http://www.mysite.com/blah-login" rel="nofollow">http://www.mysite.com/blah-login</a> or <a href="http://www.mysite.com/blah-admin" rel="nofollow">http://www.mysite.com/blah-admin</a> is redirected to my WP admin or login panel. I have following options to do that.</p>
  
  <ol>
  <li>Rewrite .htaccess file which I am not good at and don't wanna mess up my site's .htaccess      file.</li>
  <li><p>Use $wp_rewrite class which I did by writing a small plugin, its code is given below.</p>
  
  <pre><code>register_activation_hook( __FILE__, 'activate' );
  function activate() {
      rewrite();
      flush_rewrite_rules();
  }
  register_deactivation_hook( __FILE__, 'deactivate' );
  function deactivate() {
      flush_rewrite_rules();
  }
  add_action( 'init', 'rewrite' );
  function rewrite() {
      add_rewrite_rule( 'blah-admin/?$', 'wp-admin', 'top' );
      add_rewrite_rule( 'blah-login/?$', 'wp-login.php', 'top' );
      add_rewrite_rule( 'blah-register/?$', 'wp-register.php', 'top' );
  }
  </code></pre>
  
  <p>It works perfectly only problem is it does not restrict access to wp-admin, wp-login.php      or wp-registe.php (Which is must).</p></li>
  <li><p>I can write following rule to a new .htaccess file.</p>
  
  <pre><code>AuthUserFile /dev/null
  AuthGroupFile /dev/null
  AuthName "Wordpress Admin Access Control"
  AuthType Basic
  
  &lt;LIMIT GET&gt;
    order deny,allow
    deny from all
    allow from xxx.xxx.xxx.xxx
  &lt;/LIMIT&gt;
  </code></pre>
  
  <p>and place it under wp-admin folder, it has 2 drawbacks one is it will only restrict access to my wp-admin folder not wp-register.php or wp-login.php and second is I am a DHCP client so <code>allow from xxx.xxx.xxx.xxx</code> will not work for me.</p></li>
  <li><p>I could use a combination 2nd and third rule but it will definitely not work because I cannot provide an alternative permalink to a overall blocked folder.</p></li>
  <li><p>As for a last resort I could use wp-modal plugin's permalink rewriting capability, it works like a charm but this plugin is not compatible with my theme.</p></li>
  </ol>
  
  <p>So is there really a solution to my problem?</p>