1

I have three directories, Dir1,Dir2 & Dir3 in the root of my Drupal installation. I want to bypass these directories.

I have tried the below in .htaccess and its not working (Allowing subdirectories).

RewriteCond %{REQUEST_URI} "/Dir1/" [OR]
RewriteCond %{REQUEST_URI} "/Dir2/" [OR]
RewriteCond %{REQUEST_URI} "/Dir3/"
RewriteRule (.*) $1

1 Answers1

2

You have edit your .htaccess file by inserting the above code after the "RewriteEngine on" directive, before the Drupal rewrites.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} "/Dir1/" [OR]
RewriteCond %{REQUEST_URI} "/Dir2/" [OR]
RewriteCond %{REQUEST_URI} "/Dir3/"
RewriteRule (.*) $1 [L]

And add [L] in the rewrite rule which tells it to stop there and bypass the rest of the rewrite rules.

syam
  • 198
  • 1
  • 6
  • 1
    To specifically prevent further rewriting you should use a hyphen (`-`) in the _substitution_, rather than rewrite to itself (which is less efficient and could fail in some situations). ie. `RewriteRule .* - [L]` – MrWhite Dec 13 '17 at 09:22