Posted By

lifewishes on 12/10/10


Tagged

wordpress


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

ZedVex
qubestream


wordpress wp-admin rewrite


 / Published in: PHP
 

wp-admin rewrite to admin see artical http://www.michiknows.com/2007/02/12/who-else-wants-to-hide-their-wordpress-admin-folder/

  1. change secure-login to your desire url to call
  2. secure-login change in wp-login.php as well on your top most code
  3.  
  4.  
  5. .htaccess file rules
  6. ==================
  7.  
  8. # BEGIN WordPress
  9. <IfModule mod_rewrite.c>
  10.  
  11. RewriteEngine On
  12. #RewriteBase /
  13. #RewriteRule ^secure-login$ wp-login.php [L,NC,QSA]
  14. RewriteRule ^admin$ wp-login.php [L,NC,QSA]
  15.  
  16. RewriteCond %{REQUEST_FILENAME} !-d
  17. RewriteCond %{REQUEST_FILENAME} !-f
  18. RewriteRule ./index.php [L]
  19.  
  20. </IfModule>
  21.  
  22. # END WordPress
  23.  
  24.  
  25.  
  26.  
  27.  
  28. copy past this code in wp-login.php put on very top most place
  29. =====
  30.  
  31. //See what file is being requested by the web client, also store the arguments just in case.
  32. list($file,$arguments) = explode("?", $_SERVER['REQUEST_URI']);
  33. //if the user just logged out, destroy this session and redirect them to root
  34. if("/wp-login.php?loggedout=true" == $file ."?" .$arguments || "action=logout" == substr($arguments, 0, 13))
  35. { session_destroy(); header("location: /"); }
  36.  
  37. //If our sentinel variable is set and true do nothing, allow normal script execution
  38. if(isset($_SESSION['valid_entrance']) && $_SESSION['valid_entrance'] == true) { /* As they say, "Silence is golden" */ }
  39.  
  40. //Now if the user is requesting wp-login.php and our sentinel is not true, redirect the "attacker" to root.
  41. elseif(stripos($file, 'wp-login') && !isset($_SESSION['valid_entrance']))
  42. { header("Location: /"); exit(); }
  43.  
  44. //If the user is requesting the right login entrance set the sentinel to true
  45. elseif ($file == "/admin")
  46. { $_SESSION['valid_entrance'] = true; }

Report this snippet  

You need to login to post a comment.