In this wordpress tutorial i will show you how to hide the login page and wp-admin folder in wordpress. We will use two methodes for that. The first one by using a plugins and the second one is by using the fuctions.php file and the .htaccess in order to secure the login and admin pages in wordpress.
Hide The Login Page and Wp-admin
The Plugins We can use
The first plugin we can use is the Better WP Security. This plugin is too easy to use and have a feature that can hide the wp-admin and the login page by a simple click. It will add all the necessary codes to the wp-config and htaccess files.
Before we start make sure to Backup your website files and Database.
1- Install and Activate the Better WP Security plugin
2- Open the Better WP Security plugin and follow the steps.
3- Follow this Guide to Configure The Plugin : Best Better WP Security Plugin Configuration
4- The section what interest us is the : Hide Tab
5- That’s all!
The Second Plugin you can use is : Stealth Login Page
Using a Function to hide Wp-Admin Folder
Rename your Wp-admin to what you like, for example : privatefolder
1- Open the wp-config File and Add this Lines :
define('WP_ADMIN_DIR', 'privatefolder'); define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR);
2- Open your functions.php File and add this Code :
add_filter('site_url', 'wpadmin_filter', 10, 3); function wpadmin_filter( $url, $path, $orig_scheme ) { $old = array( "/(wp-admin)/"); $admin_dir = WP_ADMIN_DIR; $new = array($admin_dir); return preg_replace( $old, $new, $url, 1); }
3- Open the .htaccess file and add this lines :
RewriteRule ^privatefolder/(.*) wp-admin/$1?%{QUERY_STRING} [L]
Now you wp-admin url will be : Your-Website/privatefolder/
Hope this tutorial can help you to secure your wordpress! if you have a question don’t hesitate to use the comment form.
If you finished installation you should go to the plugin settings page and configure it. To do that navigate to the Settings menu and click Hide My WP.
Hi the php method it doesn’t work, anyway on a multisite install
For Mulitisite, you can use Lockdown WP Admin plugin… it’s the best one to use.
Hi
I really would like to hide my wp-admin & wp-login.php without using a plugin.
I followed your tutorial above, and on a number of sites.
The redirecting works, but not the blocking of wp-admin and wp-login.php
I googled a lot and can’t find much more info.
Any more tips?
Thanx
I n fact you can’t Remove / Modify or Block the wp-admin and wp-login.php because it’s a Part of WordPress Structure… The trick on my tutorial is to Redirect all users who try to get access to wp-admin or wp-login to 404 error page…