WordPress.org

Forums

Rename wp-admin without renaming it (.htaccess rewrite) (1 post)

  1. scsmash3r
    Member
    Posted 3 years ago #

    If you want to hide your wp-admin link and use some else path to reach your admin page, use this one method (I also tried these methods, but they are all having some innacuracies. So, here is my approach.

    1. Modify your .htaccess file - add this line after index.php rewrite rule:

    RewriteRule ^index\.php$ - [L]
    RewriteRule ^yoursecretpath$ wp-login.php [L,NC,QSA]

    where yoursecretpath is your path to admin panel.

    2. Modify wp-login.php file - add this code just before line 59 (where <DOCTYPE> tag starts, so to prevent headers sending error):

    <? $uri = $_SERVER['REQUEST_URI'];
    if(stripos($uri, 'wp-login') or stripos($uri, 'wp-admin') && !stripos($GLOBALS["HTTP_COOKIE"], 'wordpress_logged_in'))
    {  header("Location: /"); exit(); }
     ?>

    That's all. Ofc, this method has it's own innacuracies too, but it's the easiest way to hide your wp-admin and wp-login standart links. Works fine for single bloggers, where users registration is not necessary.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by scsmash3r
  • This topic is not a support question
  • WordPress version: 3.2.1