Title: Wp-admin Password Protected Directory
Last modified: August 20, 2016

---

# Wp-admin Password Protected Directory

 *  Resolved [Mehdi](https://wordpress.org/support/users/mahdinajafi1yahoocom/)
 * (@mahdinajafi1yahoocom)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/)
 * Hello
    Yesterday I was hacked by some strangers. I’ve been advised to protect
   my ” wp-admin ” directory by usernames and passwords and I just did it. But there’s
   a problem. Not only my ” wp-admin” has been protected but also every single page
   and post of my website has been protected! It means when a person visits my website
   and click on a post to read, a form appears and wants them to fill the username
   and password. That’s not what I wanted. I just wanted the Cpanel to be protected
   not the public posts.
 * You can check the problem here :
    [http://canot.ir/?p=5069](http://canot.ir/?p=5069)
 * How can I solve this problem?
 * The blog I need help with is canot.ir.

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [Sven D.](https://wordpress.org/support/users/sven-d/)
 * (@sven-d)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/#post-3319714)
 * Hi Mehdi
 * You are asked for the password on every post because this file is loaded from
   the **wp-admin** folder:
 * `http://canot.ir/wp-admin/admin-ajax.php`
 * I guess you have used htaccess to protect the folder, and then you can add a 
   few more lines to let everyone load this file (making it unprotected/without 
   password).
 *  [Sven D.](https://wordpress.org/support/users/sven-d/)
 * (@sven-d)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/#post-3319722)
 * You could try adding this to **.htaccess** in **wp-admin**:
 *     ```
       <Files admin-ajax.php>
       order allow,deny
       allow from all
       </Files>
       ```
   
 * Good luck
 *  Thread Starter [Mehdi](https://wordpress.org/support/users/mahdinajafi1yahoocom/)
 * (@mahdinajafi1yahoocom)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/#post-3319724)
 * Hi Sven D
    Thanks for your response. How can I add the above code to .htaccess
   I mean where should I add the code? I haven’t found anything like that.
 *  [Sven D.](https://wordpress.org/support/users/sven-d/)
 * (@sven-d)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/#post-3319727)
 * Let me reply as low tech as possible 😉
 * If you can FTP to your servers (or get access via Control Panel) then try to 
   open up for example NOTEPAD (windows program), copy and paste this in:
 *     ```
       <Files admin\-ajax\.php>
       order allow,deny
       allow from all
       </Files>
       ```
   
 * And save as this file name: **.htaccess**
 * Then transfer the file to you **wp-admin** and hopefully it will work (let your
   visitors read your posts without being asked for a username and password).
 * If everything goes wrong, just delete the file same file you uploaded.
 * If you feel unsure: contact your webhosts customer service 😉
 * Good luck!
 *  Thread Starter [Mehdi](https://wordpress.org/support/users/mahdinajafi1yahoocom/)
 * (@mahdinajafi1yahoocom)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/#post-3319730)
 * 🙂 sorry, I’m not that professional.
    I just found the file named .htaccess. 
   It was hidden. The file contains the following code:
 * > # BEGIN WordPress
   > # END WordPress
   > <Files 403.shtml>
   >  order allow,deny allow from all </Files>
 * I added your code to the above, but it didn’t work 🙁
 *  [Sven D.](https://wordpress.org/support/users/sven-d/)
 * (@sven-d)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/#post-3319731)
 * This system file ( .htaccess ) is very “delicate” and may act difrently from 
   server to server.
 * Are you sure that the file you found is located in the **wp-admin** folder? If
   yes, then maybe you can try this:
 *     ```
       # BEGIN WordPress
   
       # END WordPress
   
       <Files 403.shtml>
        order allow,deny
        allow from all
       </Files>
   
       <Files "admin-ajax.php">
        order allow,deny
        allow from all
       </Files>
       ```
   
 *  Thread Starter [Mehdi](https://wordpress.org/support/users/mahdinajafi1yahoocom/)
 * (@mahdinajafi1yahoocom)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/#post-3319733)
 * I’ve already tried that, it didn’t work.
 *  [Sven D.](https://wordpress.org/support/users/sven-d/)
 * (@sven-d)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/#post-3319734)
 * Try to ask you webhosts customer service 😉
 * They might give you a hand
 *  Thread Starter [Mehdi](https://wordpress.org/support/users/mahdinajafi1yahoocom/)
 * (@mahdinajafi1yahoocom)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/#post-3319735)
 * Thank you for your tips, Sven.
 *  [Olawale Daniel](https://wordpress.org/support/users/coolcash4live/)
 * (@coolcash4live)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/#post-3319736)
 * Helpful Sven.
 * Thanks for this
 *  Thread Starter [Mehdi](https://wordpress.org/support/users/mahdinajafi1yahoocom/)
 * (@mahdinajafi1yahoocom)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/#post-3319740)
 * Sven, You were almost there. This is the code:
 *     ```
       <Files admin-ajax.php>
           Order allow,deny
           Allow from all
           Satisfy any
       </Files>
       ```
   
 * Thanks

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Wp-admin Password Protected Directory’ is closed to new replies.

## Tags

 * [hacked](https://wordpress.org/support/topic-tag/hacked/)
 * [wp-admin](https://wordpress.org/support/topic-tag/wp-admin/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 11 replies
 * 3 participants
 * Last reply from: [Mehdi](https://wordpress.org/support/users/mahdinajafi1yahoocom/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/wp-admin-password-protected-directory/#post-3319740)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
