<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WPWife &#187; password protect wp-admin directory</title>
	<atom:link href="http://www.wpwife.com/category/password-protect-wp-admin-directory/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wpwife.com</link>
	<description>WPHelp: fix and optimise WP themes&#38;plugins</description>
	<lastBuildDate>Fri, 21 Nov 2025 12:00:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.38</generator>
	<item>
		<title>How to Password Protect Your WordPress Admin (wp-admin) Directory</title>
		<link>http://www.wpwife.com/tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory</link>
		<comments>http://www.wpwife.com/tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory#comments</comments>
		<pubDate>Tue, 28 Mar 2023 15:00:00 +0000</pubDate>
		<dc:creator><![CDATA[Editorial Staff]]></dc:creator>
				<category><![CDATA[.htaccess password for wp-admin]]></category>
		<category><![CDATA[password protect wordpress admin directory]]></category>
		<category><![CDATA[password protect wp-admin directory]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[wordpress security]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=7953</guid>
		<description><![CDATA[
<p>Do you want to learn how to password-protect your WordPress admin directory? Adding another layer of password protection to your WordPress admin directory can be a great way to improve your WordPress security. In this article, you&#8217;ll learn how you can password-protect your wp-admin directory&#8230;&#160;<strong><a href="https://www.wpbeginner.com/wp-tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/">Read More &#187;</a></strong></p>
<p>The post <a href="https://www.wpbeginner.com/wp-tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/">How to Password Protect Your WordPress Admin (wp-admin) Directory</a> first appeared on <a href="https://www.wpbeginner.com/">WPBeginner</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Do you want to learn how to password-protect your WordPress admin directory?</p>



<p>Adding another layer of password protection to your WordPress admin directory can be a great way to improve your <a title="The Ultimate WordPress Security Guide – Step by Step" href="https://www.wpbeginner.com/wordpress-security/">WordPress security</a>.</p>



<p>In this article, you’ll learn how you can password-protect your wp-admin directory easily.</p>



<figure class="wp-block-image size-full"><img width="680" height="385" src="https://www.wpbeginner.com/wp-content/uploads/2012/07/how-to-password-protect-your-wordpress-admin-wp-admin-directory-og.png" alt="How to Password Protect Your WordPress Admin (wp-admin) Directory" class="wp-image-174019" title="How to password protect your WordPress admin (wp-admin) directory" srcset="https://www.wpbeginner.com/wp-content/uploads/2012/07/how-to-password-protect-your-wordpress-admin-wp-admin-directory-og.png 680w, https://www.wpbeginner.com/wp-content/uploads/2012/07/how-to-password-protect-your-wordpress-admin-wp-admin-directory-og-300x170.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<h4>Why Password Protect Your WordPress Admin Directory?</h4>



<p>By password-protecting your WordPress admin directory, you improve the security of the most important entry point to your <meta charset="utf-8"><a title="Ultimate Guide: How to Make a Website – Step by Step Guide (Free)" href="https://www.wpbeginner.com/guides/">WordPress website</a>.</p>



<p>Your WordPress admin dashboard is the central hub of your site. It&#8217;s where you&#8217;ll publish <a title="What is the Difference Between Posts vs. Pages in WordPress" href="https://www.wpbeginner.com/beginners-guide/what-is-the-difference-between-posts-vs-pages-in-wordpress/">posts and pages</a>, customize your theme, install <a title="Premium WordPress Plugins" href="https://www.wpbeginner.com/wordpress-plugins/">WordPress plugins</a>, and more.</p>



<p>Often, when hackers try to get into your website, they’ll do it through the wp-admin screen. You can help to protect your website against potential attacks by <a href="https://www.wpbeginner.com/plugins/how-to-force-strong-password-on-users-in-wordpress/" title="How to Force Strong Password on Users in WordPress">using a secure password</a> and <a href="https://www.wpbeginner.com/plugins/how-and-why-you-should-limit-login-attempts-in-your-wordpress/" title="How and Why You Should Limit Login Attempts in WordPress">limiting login attempts</a>.</p>



<p>To be even more secure, you can also password-protect the wp-admin directory. Then when someone attempts to access your <a href="https://www.wpbeginner.com/glossary/admin-area/" title="What Is Admin Area in WordPress?">admin area</a>, they&#8217;ll need to enter a username and password before they ever make it to the WordPress login screen.</p>



<p>With that said, let’s take a look at how you can password-protect your WordPress admin directory step by step. </p>



<p>The first method is recommended for most users, and you can use the quick links below to jump straight to the method you want to use.</p>



<div class="wp-block-aioseo-table-of-contents"><ol><li><a href="https://www.wpbeginner.com/wp-tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/#password-protect-admin-directory-hosting-dashboard">Password-Protect wp-admin Using Directory Privacy (Recommended)</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/#password-protect-admin-directory-add-code">Password-Protect wp-admin Using Code</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/#aioseo-troubleshooting-wordpress-admin-password-protection">Troubleshooting wp-admin Password Protection</a></li></ol></div>



<h4 id="password-protect-admin-directory-hosting-dashboard">Method 1: Password-Protect wp-admin Using Directory Privacy (Recommended)</h4>



<p>The easiest way to password-protect your WordPress admin directory is by using your <a title="How to Choose the Best WordPress Hosting (Compared)" href="https://www.wpbeginner.com/wordpress-hosting/">WordPress hosting provider&#8217;s</a> Directory Privacy app.</p>



<p>First, you need to log in to your hosting account dashboard and click on the ‘Directory Privacy’ option in the Files section of your website&#8217;s advanced settings.</p>



<figure class="wp-block-image size-full"><img width="680" height="314" src="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacy.png" alt="Click Directory Privacy" class="wp-image-174025" srcset="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacy.png 680w, https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacy-300x139.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>


<div class="wpb-alert style-yellow">

<p><meta charset="utf-8"><strong>Note:</strong> Most web hosts using cPanel, like <a title="Bluehost" href="https://www.wpbeginner.com/refer/bluehost/"  rel="nofollow noopener">Bluehost</a>, will have similar steps. However, your dashboard might be slightly different from our screenshots depending on your hosting provider.</p>

</div>


<p>This brings you to a screen that lists all of the different directories on your server. You need to find the folder that contains your website files.</p>



<p>For most website owners, this can be found by clicking on the ‘public_html’ folder.</p>



<figure class="wp-block-image size-full"><img width="680" height="376" src="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacypublichtml.png" alt="Click public_html" class="wp-image-174036" srcset="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacypublichtml.png 680w, https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacypublichtml-300x166.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>This brings up all of the website files you’ve installed on your server.</p>



<p>Next, you&#8217;ll need to click on the folder with your website&#8217;s <a href="https://www.wpbeginner.com/beginners-guide/tips-and-tools-to-pick-the-best-domain-for-your-blog/" title="How to Choose the Best Domain Name">domain name</a>.</p>



<figure class="wp-block-image size-full"><img width="680" height="350" src="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacyexamplecom.png" alt="Click domain name folder" class="wp-image-174041" srcset="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacyexamplecom.png 680w, https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacyexamplecom-300x154.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>In that folder, you&#8217;ll see a ‘wp-admin’ folder.</p>



<p>Instead of clicking the folder name, you&#8217;ll need to click the ‘Edit’ button next to that folder.</p>



<figure class="wp-block-image size-full"><img width="680" height="409" src="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacywpadmin.png" alt="Click edit wp-admin folder" class="wp-image-174046" srcset="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacywpadmin.png 680w, https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacywpadmin-300x180.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>This brings you to a screen where you can turn on password protection.</p>



<p>Simply check the box that says ‘Password protect this directory’. If you like, you can also give your directory a name like &#8216;Admin Area&#8217; to help you remember.</p>



<figure class="wp-block-image size-full"><img width="680" height="369" src="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacypasswordprotectthisdirectory.png" alt="Check password protect directory box" class="wp-image-174051" srcset="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacypasswordprotectthisdirectory.png 680w, https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacypasswordprotectthisdirectory-300x163.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Once you&#8217;ve done that, you&#8217;ll need to click the ‘Save’ button.</p>



<p>This will take you to a page where the confirmation message will appear.</p>



<figure class="wp-block-image size-full"><img width="680" height="164" src="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacysuccess.png" alt="Confirmation message click back button" class="wp-image-174056" srcset="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacysuccess.png 680w, https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacysuccess-300x72.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Now you&#8217;ll need to click the &#8216;Go Back&#8217; button and you&#8217;ll be taken to a screen where you can create a user that will be able to access this directory.</p>



<p>You will be asked to enter a username and password, and then confirm the password. Make sure to note your username and password in a safe place, such as a <a href="https://www.wpbeginner.com/beginners-guide/what-is-the-best-way-to-manage-passwords-for-wordpress-beginners/" title="How to Easily and Securely Manage Passwords (Beginner’s Guide)">password manager app</a>.</p>



<figure class="wp-block-image size-full"><img width="680" height="340" src="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacycreateuser.png" alt="Create a User" class="wp-image-174061" srcset="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacycreateuser.png 680w, https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadmindirectoryprivacycreateuser-300x150.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Make sure you click the ‘Save’ button when you&#8217;ve done that.</p>



<p><meta charset="utf-8">Now, when someone tries to access your wp-admin directory, they will be prompted to enter the username and password you created above.</p>



<figure class="wp-block-image size-full"><img width="680" height="303" src="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadminaskingyoutosignin.png" alt="Password protect WordPress admin example" class="wp-image-174382" srcset="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadminaskingyoutosignin.png 680w, https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadminaskingyoutosignin-300x134.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<h4 id="password-protect-admin-directory-add-code">Method 2: Password-Protect wp-admin Using Code</h4>



<p>You can also password-protect your WordPress admin directory manually. To do this you’ll need to create two files called <code>.htpasswd</code> and <a href="https://www.wpbeginner.com/glossary/htaccess/" title="What is .htaccess in WordPress?"><code>.htaccess</code></a>.</p>


<div class="wpb-alert style-yellow">

<p><meta charset="utf-8"><strong>Note:</strong> Adding any code to your website can be dangerous. Even a small mistake can cause major errors on your site. We only recommend this method for advanced users.</p>

</div>


<p><strong>Creating the .htaccess File</strong></p>



<p>First, open up your preferred <a href="https://www.wpbeginner.com/showcase/12-best-code-editors-for-mac-and-windows-for-editing-wordpress-files/" title="11 Best Code Editors for Mac and Windows for Editing WordPress Files">text editor</a> and name the new file <code>.htaccess</code>.</p>



<p>After that, you need to copy the following code snippet and add it to the file.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
AuthName "Admins Only"
AuthUserFile /home/user/public_html/example.com/wp-admin/.htpasswd
AuthGroupFile /dev/null
AuthType basic
require user yourusername
</pre></div>


<p>Make sure you change the ‘AuthUserFile’ path to the location where you’ll upload the <code>.htpasswd</code> file and change ‘yourusername’ to the username you want to use to log in.</p>



<p>Don&#8217;t forget to save the file when you&#8217;re finished.</p>



<p><strong>Creating the .htpasswd File</strong></p>



<p>Once you’ve done that, you need to create a <code>.htpasswd</code> file.</p>



<p>To do this, open up a text editor and create a file called <code>.htpasswd</code>. This file will list your username along with your password in an encrypted format.</p>



<p>The easiest way to generate the encrypted password is with a <a title="htpasswd Generator" href="https://hostingcanada.org/htpasswd-generator/"  rel="noopener nofollow">htpasswd generator</a>.</p>



<p>Simply enter your username and password, select the encryption format, and click the ‘Create .htpasswd file’ button.</p>



<figure class="wp-block-image size-full"><img width="680" height="382" src="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadminhtpasswdgenerator.png" alt="Create htpasswd file" class="wp-image-174387" srcset="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadminhtpasswdgenerator.png 680w, https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadminhtpasswdgenerator-300x169.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>The htpasswd generator will display a line of text that you need to paste into your <code>.htpasswd</code> file. Make sure you save the file once you&#8217;ve done that.</p>



<p><strong>Uploading .htaccess and .htpasswd to the wp-admin Directory</strong></p>



<p>The last step is to upload both of the files you created to your website&#8217;s wp-admin folder.</p>



<p>You will need to connect to your WordPress hosting account using an <a title="6 Best FTP Clients for Mac and Windows WordPress Users" href="https://www.wpbeginner.com/showcase/6-best-ftp-clients-for-wordpress-users/">FTP client</a> or the online file manager tool provided by your hosting provider. For more details, see our beginner’s guide on <a title="How to Use FTP to Upload Files to WordPress for Beginners" href="https://www.wpbeginner.com/beginners-guide/how-to-use-ftp-to-upload-files-to-wordpress-for-beginners/">how to use FTP to upload files to WordPress</a>.</p>



<p>For this tutorial, we&#8217;ll use <a href="https://filezilla-project.org/"  rel="noopener nofollow" title="FileZilla">FileZilla</a> because it&#8217;s free and works on both Mac and Windows.</p>



<p>Once you have connected to your website, you will see the files on your computer in the left window, and the files on your website in the right. On the left, you need to navigate to the location where you saved the <code>.htaccess</code> and <code>.htpasswd</code> files.</p>



<p>Then on the right, you <meta charset="utf-8">need to go to the wp-admin directory for the website you wish to protect. Most users will need to double-click the &#8216;<meta charset="utf-8">public_html&#8217; folder, then the folder with their domain name, then the &#8216;wp-admin&#8217; folder.</p>



<p>Now you can select the two files on the left and click &#8216;Upload&#8217; from the right-click menu or simply drag the files onto the left window.</p>



<figure class="wp-block-image size-full"><img width="680" height="253" src="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadminuploadfiles.png" alt="Uploading the Files to Your Website's wp-admin Directory" class="wp-image-174105" srcset="https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadminuploadfiles.png 680w, https://www.wpbeginner.com/wp-content/uploads/2012/07/passwordadminuploadfiles-300x112.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Now your &#8216;wp-admin&#8217; directory will be password protected.</p>



<h4 id="aioseo-troubleshooting-wordpress-admin-password-protection">Troubleshooting wp-admin Password Protection</h4>



<p>Depending on how your server and website are set up, there’s a chance you might run into <a href="https://www.wpbeginner.com/common-wordpress-errors-and-how-to-fix-them/" title="50 Most Common WordPress Errors and How to Fix Them">errors</a>. These errors can be fixed by carefully adding code to your <code>.htaccess</code> file.</p>


<div class="wpb-alert style-yellow">

<p><meta charset="utf-8"><strong>Note:</strong> This is the <code>.htaccess</code> file located in your main website folder, not the one you uploaded to the &#8216;wp-admin&#8217; folder. If you&#8217;re having trouble finding it, then see our guide on <a href="https://www.wpbeginner.com/beginners-guide/why-you-cant-find-htaccess-file-on-your-wordpress-site/" title="Why You Can’t Find .htaccess File on Your WordPress Site">why you can&#8217;t find .htaccess</a> and how to locate it.</p>

</div>


<p><strong>Fixing the Ajax Not Working Error</strong></p>



<p>One of the most common errors is that Ajax functionality may stop working on the front end of your site. If you have WordPress plugins that require Ajax, such as <a href="https://www.wpbeginner.com/plugins/how-to-add-live-ajax-search-to-your-wordpress-site/" title="How to Add Live Ajax Search to Your WordPress Site (The Easy Way)">live Ajax search</a> or <a href="https://www.wpbeginner.com/plugins/how-to-build-a-wordpress-ajax-form/" title="How to Build a WordPress AJAX Form (in 4 Easy Steps)">Ajax contact forms</a>, then you will notice that these plugins won’t work anymore.</p>



<p>To fix this, simply add the following code to the <code>.htaccess</code> file that’s located in your &#8216;wp-admin&#8217; folder.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;Files admin-ajax.php&gt;
    Order allow,deny
    Allow from all
    Satisfy any 
&lt;/Files&gt;
</pre></div>


<p><strong>Fixing the 404 Error and Too Many Redirects Error</strong></p>



<p>Two other errors you might run into are the <a href="https://www.wpbeginner.com/wp-tutorials/how-to-fix-wordpress-posts-returning-404-error/" title="How to Fix WordPress Posts Returning 404 Error">404 error</a> and the <a title="How to Fix Error Too Many Redirects Issue in WordPress" href="https://www.wpbeginner.com/wp-tutorials/how-to-fix-error-too-many-redirects-issue-in-wordpress/">too many redirects error</a>.</p>



<p>The simplest way to fix them is to open up your main <code>.htaccess</code> file located in your website directory and add the following line of code before the WordPress rules.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
ErrorDocument 401 default
</pre></div>


<p>We hope this article helped you learn how to password-protect your WordPress admin (wp-admin) directory. You may also want to see our expert picks of the <a title="7 Best Email Marketing Services for Small Business" href="https://www.wpbeginner.com/showcase/best-email-marketing-services/">best email marketing services</a> for small businesses and our guide on <a title="How to Get a Free Email Domain (5 Quick and Easy Methods)" href="https://www.wpbeginner.com/beginners-guide/how-to-get-a-free-email-domain-quick-and-easy-methods/">how to get a free email domain</a>.</p>



<p>If you liked this article, then please subscribe to our <a href="https://youtube.com/wpbeginner?sub_confirmation=1"  rel="noreferrer noopener nofollow" title="Subscribe to WPBeginner YouTube Channel">YouTube Channel</a> for WordPress video tutorials. You can also find us on <a href="https://twitter.com/wpbeginner"  rel="noreferrer noopener nofollow" title="Follow WPBeginner on Twitter">Twitter</a> and <a href="https://facebook.com/wpbeginner"  rel="noreferrer noopener nofollow" title="Join WPBeginner Community on Facebook">Facebook</a>.</p><p>The post <a href="https://www.wpbeginner.com/wp-tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/">How to Password Protect Your WordPress Admin (wp-admin) Directory</a> first appeared on <a href="https://www.wpbeginner.com/">WPBeginner</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpwife.com/tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="0" type="" />
		</item>
	</channel>
</rss>
