Configure Drupal .htaccess to ignore specific subfolders

This morning I was searching for a way to configure Drupal .htccess file so that it will ignore certain subfolders. The reason was that I wanted to install a different CMS (Content Management System) inside a sub folder of Drupal root directory. As soon as I tried to run that CMS after installing into that sub directory the Clean URL functionality of this CMS was not functioning properly because of Drupal rewrite rules in .htaccess. It took me quite a while to figure out how to pull this off. But finally I have found a solution.

Add the following piece of code just below RewriteEngine on in your .htaccess present in the root directory where you have installed Drupal.

 

RewriteCond %{REQUEST_URI} !/directory/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^directory/ /directory/index.php [L]

 

Replace the directory keyword with the name of the sub folder which you want to ignore and bingo! Its done!

Tags: