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 Answer 1

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.

1
  • 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] Commented Dec 13, 2017 at 9:22

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.