Password Protected Folder Gives 404 Not Found in WordPress Installation Sub-folder.

Wordpress

Came across this little maddening issue again today after fixing it a few months back. I created a directory that is password protected using a .htaccess file. However, when trying to access this folder or anything under this directory, a File Not Found 404 error from WordPress is displayed before it even prompts you for the password. The problem here lays within the main WordPress .htaccess file

The default .htaccess file for WordPress is:

# BEGIN wordpress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END wordpress

This means that if a file is requested from the server, if it is not a file that exists in the server’s folder directory (!-f) and if it is not a directory that exists in the server’s folder directories (!-d) then pass the request onto index.php. This way, WordPress will handle both customized URLs (such as those used for SEO) and also 404 File Not Found errors.

If you set up a password protected folder in a directory included in a WordPress install, all of a sudden WordPress takes over that folder and returns a 404 page, like the file doesn’t exist.

This happens because of a little ‘gotcha’ in the apache configuration. Luckily it is an easy fix.

In the password protected folder’s .htaccess file, you may already have the entries to ask for password access. Before all of that, place the following line:

ErrorDocument 401 /401.html

Then create a 401.html in the main folder, with any text, for example:

PASSWORD PROTECTED FOLDER - Please enter the correct username/password.

Voila, you can now enter your password protected folder again.

There is another workaround this little error, but since it involves editing the main wordpress .htaccess file, it can be overridden during an upgrade.

Solution found on: http://www.webmasterworld.com/apache/3688208.htm

32 replies
  1. AddaxSoft
    AddaxSoft says:

    Life saver :)

    I spend hours trying to turn off the rewrite engine but no use

    simply this worked .. awesome !

    Regards,

  2. AddaxSoft
    AddaxSoft says:

    Life saver :)

    I spend hours trying to turn off the rewrite engine but no use

    simply this worked .. awesome !

    Regards,

  3. administration job
    administration job says:

    Business & Administration skills are critical to the growth of the UK economy. As the national standard setting body for Vocational Education in Business, Administration and Governance, the CfA (Council for Administration) leads the UK’s drive for world class skills.

  4. administration job
    administration job says:

    Business & Administration skills are critical to the growth of the UK economy. As the national standard setting body for Vocational Education in Business, Administration and Governance, the CfA (Council for Administration) leads the UK’s drive for world class skills.

  5. Richard Cummings
    Richard Cummings says:

    David, kudos on this article. It saved me. All of hostgators info was not working…and then I found this. I would think more people would have addressed this…I’m glad you did.

    Cheers,
    Richard

  6. Richard Cummings
    Richard Cummings says:

    David, kudos on this article. It saved me. All of hostgators info was not working…and then I found this. I would think more people would have addressed this…I’m glad you did.

    Cheers,
    Richard

  7. Bill Bartmann-
    Bill Bartmann- says:

    Great site…keep up the good work. I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say I’m glad I found your blog. Thanks,

    A definite great read…

    – Bill Bartmann

  8. Bill Bartmann-
    Bill Bartmann- says:

    Great site…keep up the good work. I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say I’m glad I found your blog. Thanks,

    A definite great read…

    – Bill Bartmann

  9. Tony Brown
    Tony Brown says:

    Hey, I found your blog while searching on Google your post looks very interesting for me. I will add a backlink and bookmark your site. Keep up the good work!

  10. Tony Brown
    Tony Brown says:

    Hey, I found your blog while searching on Google your post looks very interesting for me. I will add a backlink and bookmark your site. Keep up the good work!

  11. Carl Vandors
    Carl Vandors says:

    Hey very nice blog!!….I’m an instant fan, I have bookmarked you and I’ll be checking back on a regular….See ya

  12. Carl Vandors
    Carl Vandors says:

    Hey very nice blog!!….I’m an instant fan, I have bookmarked you and I’ll be checking back on a regular….See ya

  13. Marc Shaw
    Marc Shaw says:

    Hey, I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say GREAT blog!…..I”ll be checking in on a regularly now….Keep up the good work! :)

    – Marc Shaw

  14. Marc Shaw
    Marc Shaw says:

    Hey, I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say GREAT blog!…..I”ll be checking in on a regularly now….Keep up the good work! :)

    – Marc Shaw

Trackbacks & Pingbacks

  1. Dave Drager says:

    Blog Post: Password Protected Folder Gives 404 Not Found in WordPress Installation Sub-folder. http://bit.ly/f7FeG

  2. systemBash » Password Protected Folder Gives 404 Not Found in … http://bit.ly/pYM0f

  3. Mark Ford says:

    systemBash » Password Protected Folder Gives 404 Not Found in … http://bit.ly/p7ion

  4. Dave Drager says:

    New blog post: Password Protected Folder Gives 404 Not Found in WordPress Installation Sub-folder. http://tinyurl.com/cr4sau

Comments are closed.