{"id":156887,"date":"2022-01-11T14:00:43","date_gmt":"2022-01-11T14:00:43","guid":{"rendered":"https:\/\/premium.wpmudev.org\/blog\/?p=156887"},"modified":"2022-01-18T12:37:08","modified_gmt":"2022-01-18T12:37:08","slug":"hide-wordpress-login-page","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/hide-wordpress-login-page\/","title":{"rendered":"How to Easily Hide Your WordPress Login Page From Hackers"},"content":{"rendered":"<p>Change your WordPress login URL and hide your wp-admin to outsmart hackers and prevent brute-force attacks&#8230; it&#8217;s easier to make your site harder to crack than you think!<\/p>\n<p>Let&#8217;s not kid ourselves. Even script kiddies know that all they have to do to make a WordPress site owner&#8217;s life miserable is to find the\u00a0WordPress login page and guess the username and password.<\/p>\n<p><a href=\"https:\/\/wpmudev.com\/blog\/a-complete-guide-to-wordpress-password-security\/\" target=\"_blank\" rel=\"noopener\">Guessing passwords<\/a>, by the way, is not hard to do, especially if you use the same passwords for most of your logins and share your whole life on social media.<\/p>\n<p>WordPress is the most popular CMS platform in the world and this makes it\u00a0an irresistible magnet for hackers and malicious login attempts. Even the best of the best can be brought down by a stealthy maverick with access\u00a0to brute-force tools that will automatically try to guess your username and password by hitting your WordPress login page over and over and over again.<\/p>\n<h2>Hide Your WordPress Login Page with 4 Different Ways:<\/h2>\n<p>1. <a href=\"#hidewithloginphp\">Hide wp-login.php Using a Plugin<\/a><br \/>\n2. <a href=\"#hidewithoutplugin\">Hide WordPress Login Page Without A Plugin<\/a><br \/>\n3. <a href=\"#Hidewithhtaccess\">Hide WP Login page with .htaccess<\/a><br \/>\n4. <a href=\"#Hidewithcode\">Hide WP Login with Code<\/a><\/p>\n<h3>The Best Way To Fight Against Brute-Force Attacks&#8230; Hide!<\/h3>\n<p>Brute force attempts to log into WordPress are so common,\u00a0<a href=\"https:\/\/codex.wordpress.org\/Brute_Force_Attacks\" rel=\"noopener\" target=\"_blank\">there&#8217;s even a page in the Codex<\/a> dedicated to the topic.<\/p>\n<p>But&#8230; why give hackers and malicious bots the opportunity to even try and guess your login details? Just hide your WordPress login page and most bots and automated software won&#8217;t even know that your site exists.<\/p>\n<p>In this article, you will learn how to implement one of the simplest and easiest strategies to protect your site from hackers and malicious bots: change your WordPress login URL, hide your\u00a0<em>wp-admin<\/em>\u00a0and\u00a0<em>wp-login\u00a0<\/em>page and redirect unwanted visitors away from your login page.<\/p>\n<figure id=\"attachment_180582\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-180582 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/wordpress-hide-login-page.png\" alt=\"WordPress hide login page\" width=\"600\" height=\"400\" \/><figcaption class=\"wp-caption-text\">Leave it open a crack and hackers will hack. Hide the WordPress login page&#8230; no malicious attack!<\/figcaption><\/figure>\n<h3>Why Change The WordPress Login URL?<\/h3>\n<p>I have a standard WordPress site that I installed a few years ago. To get to the login page all you have to do is go to <em>\/wp-admin<\/em>\u00a0or <em>\/wp-login.php<\/em>.<\/p>\n<p>This site doesn&#8217;t see a ton of traffic. In a typical month, it generates about 5,000 pageviews. However, the site&#8217;s login page sees malicious login attempts on a startlingly regular basis. I have the <a href=\"https:\/\/wordpress.org\/plugins\/defender-security\/\" rel=\"noopener\" target=\"_blank\">Defender<\/a> plugin activated on this site, and it tracks the number of blocked malicious login attempts. Since I&#8217;ve started tracking the number of blocked malicious login attempts, I can see that my site handles\u00a0hundreds of malicious login attempts each month, averaging about <a href=\"https:\/\/twitter.com\/WadeGibson\/status\/1090616365633990656\" rel=\"noopener\" target=\"_blank\">24 per day, or one malicious login attempt every 60 minutes<\/a>.<\/p>\n<p>Login attempts don&#8217;t happen at a regular pace of one per hour. Weeks can go by without a single malicious login attempt being logged. Then, suddenly, a few hundred or even a couple of thousand login attempts will be logged in a short period of time.<\/p>\n<p>Most WordPress sites\u00a0set up as standard installations periodically experience brute force attacks attempting to log into the WordPress dashboard. Yours probably does too, whether you know it or not.<\/p>\n<figure id=\"attachment_180512\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-180512 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/defender-ip-lockout-logs.jpg\" alt=\"Defender IP Lockout logs.\" width=\"600\" height=\"556\" \/><figcaption class=\"wp-caption-text\">Brute-force attack bots are constantly looking to break into your WordPress site, whether you know it or not.<\/figcaption><\/figure>\n<h3>WordPress Security Through Obscurity<\/h3>\n<p>You may think that using canny logins will keep your site safe.<\/p>\n<p>Hackers can easily tell if a site is powered by WordPress or not (often just by looking at the page source).<\/p>\n<figure id=\"attachment_180586\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-180586 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/view-page-source.png\" alt=\"Google Chrome browser - View page source option\" width=\"600\" height=\"479\" \/><figcaption class=\"wp-caption-text\">Hackers can easily tell if your site runs on WordPress, work out your canny logins, and deliver you even greater hits.<\/figcaption><\/figure>\n<p>Once a hacker knows that your site runs on WordPress, they also know <a href=\"https:\/\/wpmudev.com\/blog\/find-wordpress-login\/\" target=\"_blank\" rel=\"noopener\">how to find your WordPress login URL<\/a>\u00a0(spoiler alert: the default WordPress login URL is found by entering your domain name, followed by\u00a0<code>\/wp-login.php<\/code>).<\/p>\n<p>Default WordPress behavior loads the login page when you access <em>wp-login.php<\/em>. Type in <em>wp-admin<\/em> instead, and you&#8217;ll be automatically redirected to <em>wp-login.php<\/em>.<\/p>\n<p>Unless you know\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/change-admin-username\/\" target=\"_blank\" rel=\"noopener\">how to change your admin username<\/a>, your friendly neighborhood <del>motherf<\/del> hacker will also know that your username is most likely something like <code>admin<\/code>.<\/p>\n<p>All the hacker has to do now is guess the password. Even if they can&#8217;t guess the password but keep trying to, this can use up your server&#8217;s resources and possibly end up taking your site down.<\/p>\n<figure id=\"attachment_180587\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-180587 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/wp-login-page-admin-password.png\" alt=\"WP login page username admin\" width=\"600\" height=\"490\" \/><figcaption class=\"wp-caption-text\">If hackers dance illegally around your canny logins long enough, they&#8217;ll probably generate enough hits to guess your password.<\/figcaption><\/figure>\n<h3>If They Can&#8217;t See It, They Can&#8217;t Crack It<\/h3>\n<p>Many hackers are opportunistic and look for low hanging fruit that&#8217;s ripe and easy pickings.<\/p>\n<p>If you don&#8217;t want people to steal your fruit, hide your tree.<\/p>\n<p>Continuing with this really poor analogy (when life gives you lemons&#8230;), your WordPress login page gives admin users access to the whole orchard, so as part of our strategy of creating &#8216;security through obscurity,&#8217; let&#8217;s hide your login page URL from everyone else but the admin.<\/p>\n<h3>Optional Step: Install WordPress In Its Own Directory<\/h3>\n<p>Whether you&#8217;re dealing with a brand new WordPress installation or an existing WordPress website, whenever possible consider\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/install-wordpress-subdirectory\/\" target=\"_blank\" rel=\"noopener\">installing WordPress in a subdirectory<\/a>. While this won&#8217;t prevent hackers from finding your WordPress login page if they deliberately choose to target your site, it will discourage many random bots and malicious users looking for easy targets to start hitting up your site and shaking your tree to see what falls out.<\/p>\n<p>Having your WordPress site installed in a subdirectory, then, is a good first step toward creating &#8216;security through obscurity.&#8217;<\/p>\n<p>If you&#8217;re moving an existing WordPress installation, before you do anything else, <a href=\"https:\/\/wpmudev.com\/project\/snapshot\/\" target=\"_blank\" rel=\"noopener\">create a complete backup of your site<\/a> and store it someplace where you won&#8217;t accidentally delete or modify it. (Related: <a href=\"https:\/\/wpmudev.com\/blog\/backup-wordpress-bulletproof-protection\/\" target=\"_blank\" rel=\"noopener\">How to Back Up Your Backups For Bulletproof Protection<\/a>)<\/p>\n<p>One more thing. When creating a subdirectory, choose a name that&#8217;s not too predictable like\u00a0<em>http:\/\/example.com\/wordpress<\/em> or <em>http:\/\/example.com\/wp<\/em>. Instead, choose something unique that no one will ever be able to guess like <em>http:\/\/example.com\/dwiiw<\/em>\u00a0(an acronym for\u00a0<i><b>d<\/b>irectory <b>w<\/b>here <b>I<\/b> <b>i<\/b>nstalled <b>W<\/b>ordPress<\/i>.)<\/p>\n<figure id=\"attachment_180531\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-180531\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/wordpress-installed-in-subdirectory.jpg\" alt=\"WordPress login screen.\" width=\"600\" height=\"575\" \/><figcaption class=\"wp-caption-text\">Tip: Install WordPress in its own directory with a hard to find subdirectory name.<\/figcaption><\/figure>\n<p>Whether you choose to install WordPress in a subdirectory or not as an added security precaution is up to you.<\/p>\n<p>The next step is to hide your login page URL (and optionally redirect wp-login.php visitors to another page on your site).<\/p>\n<p>There are a few ways you can hide your WP login page from other users:<\/p>\n<ul>\n<li>Use a plugin to\u00a0mask your login URL (the easiest way)<\/li>\n<li>Mask your WordPress login URL without a plugin (the geek way)<\/li>\n<li>Modify your <a href=\"https:\/\/wpmudev.com\/blog\/htaccess\/\" target=\"_blank\">.htaccess<\/a> file (the &#8220;I need to code everything from scratch&#8221; way)<\/li>\n<\/ul>\n<h3>Hide Your Site Login Page &#8211; Disclaimer<\/h3>\n<p>Before we get started, the strategy shared below isn&#8217;t recommended if your site requires a login page that needs to remain easy for other users to find (like a membership site).<\/p>\n<p>If your site is not a membership site and login attempts are limited to a dozen or fewer admins, authors, editors, and contributors, then hiding your login page will help protect your site against malicious login attempts.<\/p>\n<h3 id=\"hidewithloginphp\">1. Hide wp-login.php Using a Plugin<\/h3>\n<p>There are a number of free WordPress plugins that will let you hide the login page URL. Some of these plugins will also let you redirect wp-login.php visitors to another page of your website. Just visit the WordPress.org plugins directory and search for &#8220;Hide WP Login&#8221; to see a list of security plugins that you can use.<\/p>\n<p>For this tutorial, we&#8217;ll use WPMU DEV&#8217;s own\u00a0<strong>Defender<\/strong> plugin.<\/p>\n<p>Defender\u00a0lets you hide <em>and<\/em> redirect wp-login.php, and includes many other top gun security features.<\/p>\n<figure id=\"attachment_180590\" class=\"wp-caption aligncenter\" data-caption=\"true\"><a rel=\"noopener\" class=\"blog-thumbnail\" href=\"https:\/\/wordpress.org\/plugins\/defender-security\/\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-180590 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/defender-wordpress-security-plugin.png\" alt=\"Defender WordPress security plugin\" width=\"600\" height=\"280\" \/><\/a><figcaption class=\"wp-caption-text\">Defender protects your site from hackers and brute-force attacks.<\/figcaption><\/figure>\n<p>You can <a href=\"https:\/\/wordpress.org\/plugins\/defender-security\/\" rel=\"noopener\" target=\"_blank\">download Defender for free<\/a> from the WordPress plugin repository or if you&#8217;re a <a href=\"https:\/\/wpmudev.com\/#trial\" target=\"_blank\" rel=\"noopener\">WPMU DEV member<\/a>, go ahead and install <a href=\"https:\/\/wpmudev.com\/project\/wp-defender\/\" target=\"_blank\" rel=\"noopener\">Defender Pro<\/a> from your <a href=\"https:\/\/wpmudev.com\/hub-welcome\/\" target=\"_blank\" rel=\"noopener\">WordPress site management hub<\/a>.<\/p>\n<figure id=\"attachment_180518\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-180518 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/install-defender-pro-WordPress-security-plugin.jpg\" alt=\"Defender Pro WordPress security plugin installation screen.\" width=\"600\" height=\"825\" \/><figcaption class=\"wp-caption-text\">Install Defender WordPress security plugin and make your WordPress login page invisible to hackers.<\/figcaption><\/figure>\n<p><em>Note:<\/em> For full installation and configuration instructions, see the <a href=\"https:\/\/wpmudev.com\/docs\/wpmu-dev-plugins\/defender\/\" target=\"_blank\" rel=\"noopener\">Defender plugin documentation<\/a> section.<\/p>\n<p>After installing and activating the plugin, navigate to your main WordPress dashboard menu and go to <em>Defender &gt; Dashboard<\/em>.<\/p>\n<p>Locate the &#8216;Mask Login Area&#8217; section and click on the &#8216;Active&#8217; button to turn on the feature.<\/p>\n<figure id=\"attachment_180528\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-180528\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/activate-mask-login-defender.png\" alt=\"Activate Mask Login Area - Defender WordPress Security Plugin\" width=\"600\" height=\"250\" \/><figcaption class=\"wp-caption-text\">Activate Defender&#8217;s &#8216;Mask Login Area&#8217; to hide your WP login URL.<\/figcaption><\/figure>\n<p>Click the &#8216;Finish Setup&#8217; button to bring up the URL masking options screen.<\/p>\n<figure id=\"attachment_180532\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-180532\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/setup-mask-login-defender.jpg\" alt=\"Defender Mask Login Area Finish Setup screen.\" width=\"600\" height=\"221\" \/><figcaption class=\"wp-caption-text\">Click the button and let&#8217;s activate the WordPress move login page feature.<\/figcaption><\/figure>\n<p>This brings up the Advanced Tools screen.<\/p>\n<figure id=\"attachment_180541\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-180541\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/defender-advanced-tools-screen.png\" alt=\"Defender - Advanced Tools screen.\" width=\"600\" height=\"452\" \/><figcaption class=\"wp-caption-text\">Defender &#8216;Advanced Tools&#8217; screen.<\/figcaption><\/figure>\n<p>In the <em>Masking URL<\/em> section, enter a new URL slug where your site users will go to log in or register on your site. Once again, I recommend choosing something that you can easily remember, but everyone else will be unable to randomly guess.<\/p>\n<p>For this example, let&#8217;s use the same acronym method used earlier to come up with the directory name <em>dwiiw\u00a0<\/em>and let&#8217;s name our new WordPress login URL something unique like:<\/p>\n<p><em>http:\/\/example.com\/dwiiw\/gli<\/em><\/p>\n<p>In this case, <em>gli<\/em>\u00a0stands for <i><b>g<\/b>et <b>l<\/b>ogged <b>i<\/b>n<\/i>, and it accomplishes the goal of being simultaneously easy to remember and hard to guess.<\/p>\n<p style=\"text-align: left;\"><figure class=\"wp-caption center\" data-caption=\"true\"><video loop muted autoplay playsinline class='dev-html5-video'><source src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/defender-masking-url.webm\" type=\"video\/webm\"><source src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/defender-masking-url.mp4\" type=\"video\/mp4\"><\/video><figcaption class=\"wp-caption-text\">Make your new WordPress login URL slug difficult for hackers to guess.<\/figcaption><\/figure><\/p>\n<p>Save your changes and log out of your WordPress site.<\/p>\n<p>Now, try to log back in via the default\u00a0login page at <em>yourdomain.com\/wp-login.php<\/em>.<\/p>\n<figure id=\"attachment_180543\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-180543\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/masked-wordpress-login-page-url.png\" alt=\"Masked WordPress login page URL.\" width=\"600\" height=\"195\" \/><figcaption class=\"wp-caption-text\">Wait&#8230; what? Where&#8217;s the WordPress login box?<\/figcaption><\/figure>\n<p>Normally, typing <em>wp-admin<\/em>\u00a0into a web browser automatically redirects users to <em>wp-login.php<\/em>. Defender also disables this feature.<\/p>\n<figure id=\"attachment_180544\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-180544\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/masked-wp-admin-url.png\" alt=\"Masked WordPress wp-admin page.\" width=\"600\" height=\"240\" \/><figcaption class=\"wp-caption-text\">Help&#8230; I&#8217;m a hacker, let me in!<\/figcaption><\/figure>\n<p>Only users with access to the masked URL will now see the WordPress login page.<\/p>\n<figure class=\"wp-caption center\" data-caption=\"true\"><video loop muted autoplay playsinline class='dev-html5-video'><source src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/defender-masked-login.webm\" type=\"video\/webm\"><source src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/defender-masked-login.mp4\" type=\"video\/mp4\"><\/video><figcaption class=\"wp-caption-text\">Your WordPress login page URL is now masked.<\/figcaption><\/figure>\n<p><em>Tip:<\/em>\u00a0As an extra nice touch for your users, you may also want to <a href=\"https:\/\/wpmudev.com\/blog\/customize-login-page\/\" target=\"_blank\" rel=\"noopener\">customize your WordPress login page<\/a>,\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/20-wordpress-plugins-for-improved-user-login-and-registration\/\" target=\"_blank\" rel=\"noopener\">install plugins for improved user login and registration<\/a>, or let users <a href=\"https:\/\/wpmudev.com\/blog\/email-login\/\" target=\"_blank\" rel=\"noopener\">login to WordPress using an email address<\/a>. If only certain users are allowed to access your admin section, however, then you can <a href=\"https:\/\/wpmudev.com\/blog\/limit-access-login-page\/\" target=\"_blank\" rel=\"noopener\">limit access to the login page for specific users by IP addresses<\/a>.<\/p>\n<figure id=\"attachment_143920\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-143920 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/07\/custom-login-page-.jpg\" alt=\"WordPress custom login page.\" width=\"735\" height=\"410\" \/><figcaption class=\"wp-caption-text\">A customized WordPress login page. No security benefits whatsoever, but niiiice!<\/figcaption><\/figure>\n<h3>Optional Step:\u00a0Redirect wp-login.php<\/h3>\n<p>Using the method shown above, anyone that tries to visit the default WordPress login page (i.e. <em>wp-login.php<\/em>) will be greeted with an error message (&#8220;This feature is disabled&#8221;).<\/p>\n<p>If you want to send visitors and users (or even hackers) to a different page (e.g. your store page, contact page, FAQ section, or any other page on your site), you can redirect the default\u00a0<em>wp-login.php<\/em>\u00a0URL using Defender&#8217;s <em>Redirect traffic<\/em> feature.<\/p>\n<p>To redirect the wp-login.php page, go to the WP dashboard menu and select <strong>Defender &gt; Advanced Tools &gt; Mask Login Area<\/strong>.<\/p>\n<p>Enable 404 Redirection in the\u00a0<strong>Redirect traffic<\/strong>\u00a0section, enter the slug of the page you want to send visitors to, and click <strong>Save Changes<\/strong> to update your settings.<\/p>\n<figure id=\"attachment_180547\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-180547 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/defender-redirect-traffic-URL.png\" alt=\"Defender Redirect Traffic URL\" width=\"600\" height=\"210\" \/><figcaption class=\"wp-caption-text\">Ok hackers, time to see if crime really pays&#8230;<\/figcaption><\/figure>\n<p>Now, anyone who tries to\u00a0visit the default login URL will be redirected to the post or page you have specified.<\/p>\n<p style=\"text-align: left;\"><figure class=\"wp-caption center\" data-caption=\"true\"><video loop muted autoplay playsinline class='dev-html5-video'><source src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/defender-redirect-wp-login-url.webm\" type=\"video\/webm\"><source src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/defender-redirect-wp-login-url.mp4\" type=\"video\/mp4\"><\/video><figcaption class=\"wp-caption-text\">C'mon hackers... give 'till it hurts!<\/figcaption><\/figure><\/p>\n<p><em>Notes:<\/em><\/p>\n<ul>\n<li>You can use any combination of a-z and 0-9 in your slug.<\/li>\n<li>You can\u2019t add full URLs (this prevents sending out your 404 errors to another domain).<\/li>\n<\/ul>\n<h3 id=\"hidewithplugin\">2. Hide WordPress Login Page Without A Plugin<\/h3>\n<p>If you want to hide your login page without using a plugin, all you need is a text editor, access to your WordPress installation files (<a href=\"https:\/\/wpmudev.com\/blog\/ftp-wordpress\/\" target=\"_blank\" rel=\"noopener\">FTP<\/a>, cPanel File Manager, etc), and then do the following:<\/p>\n<p><strong>1 &#8211; Make a backup of your wp-login.php file. <\/strong><\/p>\n<p>While you are at it, go ahead and make a backup of everything else too, as you&#8217;re about to mess with code and enter the danger zone!<\/p>\n<figure id=\"attachment_180561\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-180561\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/wp-login-php-code.png\" alt=\"wp-login.php file code\" width=\"600\" height=\"551\" \/><figcaption class=\"wp-caption-text\">Back up your wp-login.php file and copy all the code to your clipboard.<\/figcaption><\/figure>\n<p>Note: If you&#8217;re looking for a great plugin to backup and restore your files and WordPress site, we recommend using our very own <a href=\"https:\/\/wpmudev.com\/project\/snapshot\/\" target=\"_blank\" rel=\"noopener\">Snapshot<\/a>.<\/p>\n<p>Next, open your wp-login.php file. Select and copy all the code to your clipboard.<\/p>\n<p><strong>2 &#8211; Create a new PHP login file.\u00a0<\/strong><\/p>\n<p>Create a new file using your text editor. Call this file anything you like (e.g. &#8216;canny-login.php&#8217;, &#8216;danger-zone.php&#8217; etc.).<\/p>\n<p>Paste the code from your existing wp-login.php file into your new file and save.\u00a0Alternatively, open your wp-login.php file and &#8216;save as&#8217; your new filename.<\/p>\n<figure id=\"attachment_180562\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-180562 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/new-wp-login-file.png\" alt=\"wp-login.php file code renamed.\" width=\"600\" height=\"551\" \/><figcaption class=\"wp-caption-text\">Your renamed wp-login file. Same code, edgy filename.<\/figcaption><\/figure>\n<p><strong>3 &#8211; Search and replace the &#8216;wp-login.php&#8217; string in your new file code.<\/strong><\/p>\n<p>Search and replace every instance of &#8216;wp-login.php&#8217; in the code with your new login filename.<\/p>\n<figure id=\"attachment_180563\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-180563\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/search-replace-wp-login-php.png\" alt=\"Search and replace wp-login.php string\" width=\"600\" height=\"551\" \/><figcaption class=\"wp-caption-text\">Search and replace all instances of &#8216;wp-login.php&#8217; with your new login filename.<\/figcaption><\/figure>\n<p>Resave the file with the modified code.<\/p>\n<p><strong>4 &#8211;\u00a0Upload your new login file to your server.<\/strong><\/p>\n<p>Log into your server and upload the new login file to the root folder or directory where you have installed WordPress.\u00a0Delete the original\u00a0<em>wp-login.php<\/em> file from your server.<\/p>\n<p style=\"text-align: left;\"><figure class=\"wp-caption center\" data-caption=\"true\"><video loop muted autoplay playsinline class='dev-html5-video'><source src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/delete-wp-login-php-file.webm\" type=\"video\/webm\"><source src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/delete-wp-login-php-file.mp4\" type=\"video\/mp4\"><\/video><figcaption class=\"wp-caption-text\">Replace wp-login.php in your server with your new login file.<\/figcaption><\/figure><\/p>\n<p><strong>5 &#8211; Update the default login and logout URLs.<\/strong><\/p>\n<p>The last step is to hook into the <code>login_url<\/code> and <code>logout_url<\/code> filters to update our file.<\/p>\n<p>Add the following code to your theme&#8217;s <code>functions.php<\/code> (preferably in your <a href=\"https:\/\/wpmudev.com\/blog\/create-wordpress-child-theme\/\" target=\"_blank\" rel=\"noopener\">child theme<\/a>):<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">add_filter( &#039;logout_url&#039;, &#039;custom_logout_url&#039; );\r\nfunction custom_logout_url( $default )\r\n{\r\nreturn str_replace( &#039;wp-login&#039;, &#039;danger-zone&#039;, $default );\r\n}\r\nadd_filter( &#039;login_url&#039;, &#039;custom_login_url&#039; );\r\nfunction custom_login_url( $default )\r\n{\r\nreturn str_replace( &#039;wp-login&#039;, &#039;danger-zone&#039;, $default );\r\n}<\/pre>\n<p><strong>6 &#8211; Test your new login URL<\/strong><\/p>\n<p>Test your new login page URL. Anyone visiting the default wp-login.php page will experience an error.<\/p>\n<figure class=\"wp-caption center\" data-caption=\"true\"><video loop muted autoplay playsinline class='dev-html5-video'><source src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/test-new-wordpress-login-url.webm\" type=\"video\/webm\"><source src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/test-new-wordpress-login-url.mp4\" type=\"video\/mp4\"><\/video><figcaption class=\"wp-caption-text\">No canny logins for stealthy hackers here unless they know how to cruise on the highway to the danger zone.<\/figcaption><\/figure>\n<p>To revert to the original login page, simply restore the wp-login.php file from your backup and delete the new file from your server.<\/p>\n<h3 id=\"Hidewithhtaccess\">3. WordPress Login URL .htaccess File Hacks<\/h3>\n<p>There are ways to &#8216;obscure&#8217; your WordPress login details using the .htaccess file. Obscuring your WordPress login URL, however, doesn&#8217;t necessarily mean hiding it from others.<\/p>\n<p>For example, let&#8217;s take a look at what happens when you add URL forwarding to your .htaccess.\u00a0Remember to <a href=\"https:\/\/wpmudev.com\/blog\/backup-with-snapshot\/\" target=\"_blank\" rel=\"noopener\">make a complete backup of your site<\/a> before making any changes to your .htaccess file.<\/p>\n<h3>WordPress Login Page Obscurity With URL Redirection<\/h3>\n<p>You can change the location of your login page by changing the name of your WordPress login file using the <a href=\"https:\/\/httpd.apache.org\/docs\/current\/mod\/mod_rewrite.html\" rel=\"noopener\" target=\"_blank\">mod_rewrite module<\/a> in an Apache server.<\/p>\n<p>To do this, add the line below to your .htaccess file (note: replace &#8216;newloginpage&#8217; with any alias and change the <em>example.com<\/em> URL to your domain):<\/p>\n<p><code>RewriteRule ^newloginpage$ http:\/\/www.example.com\/wp-login.php [NC,L]<\/code><\/p>\n<p>In this example, we&#8217;ll add an alias called &#8216;dancekevindance&#8217; and reupload the\u00a0.htaccess file to our server:<\/p>\n<figure id=\"attachment_180576\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-180576 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/url-forwarding-ht-access.png\" alt=\"URL forwarding htaccess file\" width=\"600\" height=\"355\" \/><figcaption class=\"wp-caption-text\">Let&#8217;s rewrite the rules and see if we can hide our canny logins.<\/figcaption><\/figure>\n<p>Now, go back to the site and enter the new URL.<\/p>\n<figure class=\"wp-caption center\" data-caption=\"true\"><video loop muted autoplay playsinline class='dev-html5-video'><source src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/test-url-forwarding.webm\" type=\"video\/webm\"><source src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2100\/10\/test-url-forwarding.mp4\" type=\"video\/mp4\"><\/video><figcaption class=\"wp-caption-text\">URL forwarding doesn't hide the WP login URL, it just dances around the issue.<\/figcaption><\/figure>\n<p>As you can see, the above method doesn&#8217;t <em>hide<\/em> the default WordPress login URL, it merely creates an <em>alias<\/em> that lets users log into their WordPress dashboard using a web address that is easier for them to remember than <code>https:\/\/yourexample.com\/wp-login.php<\/code>.<\/p>\n<h3 id=\"Hidewithcode\">4. Hide Your WordPress Login Page With Code<\/h3>\n<p>Ideally, we recommend just sticking to using a plugin if you want to change your WordPress login URL, hide the wp-admin wp-login.php pages, or redirect users away from the default login page. Messing with code can cause compatibility issues, slow down your site, and create other problems.<\/p>\n<p>If you want to look at other options that involve code, however, then check out this post we&#8217;ve written about <a href=\"https:\/\/wpmudev.com\/blog\/hide-wordpress-login-page-2\/\" target=\"_blank\" rel=\"noopener\">hiding your WordPress login page from hackers with code<\/a>.<\/p>\n<h3>Don&#8217;t Let Them Gonna Take You Right Into The Danger Zone<\/h3>\n<p>WordPress is a magnet for hackers and malicious bots, so it&#8217;s important to understand\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/wordpress-security-best-practices\/\" target=\"_blank\" rel=\"noopener\">WordPress security best practices<\/a> and implement multiple\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/ultimate-guide-wordpress-security\/\" target=\"_blank\" rel=\"noopener\">WordPress security strategies<\/a>\u00a0to protect your site from hackers and brute-force attacks. This includes security through obscurity.<\/p>\n<p>When used as part of a more comprehensive security strategy, obscurity can be helpful.\u00a0As we&#8217;ve just seen, however, simply hiding the WordPress login page\u00a0is not enough to guarantee that you will see zero malicious login attempts.<\/p>\n<p>Unless you actually change\u00a0the WordPress login URL of your site and redirect unwanted visitors away from pages like <em>wp-login.php<\/em> and <em>wp-admin<\/em>, hackers and bots will still be able to find your login page and attempt to guess your login details.<\/p>\n<p>Messing with code can cause compatibility issues, slow down your site, and create other problems.\u00a0Using a plugin like <a href=\"https:\/\/wordpress.org\/plugins\/defender-security\/\" rel=\"noopener\" target=\"_blank\">Defender<\/a> is the easiest way to hide your WordPress login page from hackers and make it all but invisible to the vast majority of low-flying malicious login attempts.<\/p>\n<p>To protect your site against the worst of the worst, you need help from the best of the best. If you&#8217;re not a member of WPMU DEV yet, join our elite group of top gun WordPress developers and website owners <a href=\"https:\/\/wpmudev.com\/#trial\" target=\"_blank\" rel=\"noopener\">100% risk-free<\/a>\u00a0and get access to all the security tools, protection features, and support your site needs to fly high and free out of the danger zone.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Change your WordPress login URL and hide your wp-admin to outsmart hackers and prevent brute-force attacks&#8230; it&#8217;s easier to make your site harder to crack than you think! Let&#8217;s not kid ourselves. Even script kiddies know that all they have to do to make a WordPress site owner&#8217;s life miserable is to find the\u00a0WordPress login [&hellip;]<\/p>\n","protected":false},"author":774618,"featured_media":156916,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[263,11260],"tags":[10810,11186,10478],"tutorials_categories":[],"class_list":["post-156887","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-wpmu-dev-products","tag-wordpress-security","tag-wordpress-login-page","tag-defender"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/156887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/774618"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=156887"}],"version-history":[{"count":28,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/156887\/revisions"}],"predecessor-version":[{"id":180603,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/156887\/revisions\/180603"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/156916"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=156887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=156887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=156887"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=156887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}