Exclude a folder/directory from RewriteRule Exclude a folder/directory from RewriteRule wordpress wordpress

Exclude a folder/directory from RewriteRule


You may try replacing the complete WP rule-set with this one:

# BEGIN WordPressRewriteEngine OnRewriteBase /RewriteRule ^index.php$ - [L]# Include in the next line all folders to excludeRewriteCond %{REQUEST_URI}  !(folder1|folder2|folder3) [NC]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]# END WordPress 


In the .htaccess file in your site root, add the following ABOVE the WordPress .htaccess directives:

<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_URI} ^/subdirectoryname1/(.*)$ [OR]RewriteCond %{REQUEST_URI} ^/subdirectoryname2/(.*)$ [OR]RewriteRule ^.*$ - [L]</IfModule>


# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteRule ^/(folder1)/(.*) /folder1/$2 [R]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L,R]</IfModule># END WordPress