Drupal: Take back control of a folder from Drupal and password protecting it
January 09, 2009
Drupal | PHP | Troubleshooting | Web Building

error.jpeg


By default, Drupal takes control of all subdirectories within its root folder. If Drupal resides within the web root of your site, you will not be able to get to any subdirectories that are non-Drupal related. Drupal will give a "Page Not Found" error on any page that doesn't have Drupal content associated with it.


Ads by Google

Posted by ellen at January 09, 2009 06:53 PM

To prevent this, add these lines to the .htaccess file, right after the "RewriteEngine on" directive, one line for each directory you want to hold out of Drupal's control:

<IfModule mod_rewrite.c>
RewriteEngine on
# =========[ start of .htaccess snippet]==========
 
#
# stuff to let through (ignore)
RewriteCond %{REQUEST_URI} "/subdirectory1/" [OR]
RewriteCond %{REQUEST_URI} "/subdirectory2/" [OR]
RewriteCond %{REQUEST_URI} "/subdirectory3/"
RewriteRule (.*) $1 [L]
#
# ====================[ end ]=====================
Note that the last subdirectory in the list does not get an "[OR]"

Then, add the following to the .htaccess in the password protected directory:


#the following allows users in to this directory without drupal interfering
ErrorDocument 401 "Unauthorized"


Ads by Google


Ads by Google

 RSS   |   Contact Me


Ads by Google