ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

directory protection forces 404 error

March 05, 2012 6:40am

Subscribe [1]
  • #1 / Mar 05, 2012 6:40am

    magicmarkuk

    89 posts

    Hello

    I have created a new directory on my site which is running a script with an index.php file. It all works ok but for development purposes I want to password protect the directory. No problem so far.

    However, as soon as I password protect the directory when I try and go to it intsead of getting promoted for a username and password I am getting a 404 error.

    Is expression engine causing this relating to the index.php issue or does anyone know how to get around it?

    For reference the .htacess in the root of my site is as follows:

    # rewrite rules
    RewriteEngine On
    
    # ditch index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    # BEGIN WordPress
    
    # END WordPress

    Many thanks
    Mark

  • #2 / Mar 05, 2012 3:30pm

    magicmarkuk

    89 posts

    Just an update I have resolved this by using the 401 trick i.e.

    Within the .htacess file of the protected directory add the following line at the beginning:

    ErrorDocument 401 /401.html

    Create an html document called 401.html and place in the root directory with the following text:

    PASSWORD PROTECTED FOLDER - Please enter the correct username/password

    Works a treat!

    Mark

  • #3 / Mar 05, 2012 8:18pm

    Sean C. Smith

    3818 posts

    Mark,

    I’m happy to see that you found the answer to your problem Is there anything else I can assist you with?

    Sean

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases