How to ignore multiple folders WordPress htaccess

Can you please explain how it will be if we want to ignore multiple folder

sami Asked on August 18, 2016 in WordPress.
Add Comment
1 Answer(s)

In order to avoid the situation you are referring to you can use two different approaches:

The first one is to add the following rule in the .htaccess file of your WordPress application for each subfolder that you want to exclude:

RewriteRule ./subfolder /index.php [L]

For example if you have subfolders from 1 to 5 and you want to exclude the first three from the WordPress .htaccess rules you need to place these three lines instead of the RewriteRule . /index.php [L] one:

RewriteRule ./subfolder1 /index.php [L]

RewriteRule ./subfolder2 /index.php [L]

RewriteRule ./subfolder3 /index.php [L]

This will allow you to load the files from these three directories but the files from the other two (subfolder4 and subfolder5) will lead to your WordPress application.

The second one is to add an .htaccess file in each subdirectory containing the following lines:

# Disable the rewrite engine
RewriteEngine off

This will allow the files from the subfolders containing the above-mentioned htaccess file to be loaded and the ones that do not contain it will be redirected to the WordPress application.

Joe Benson Answered on August 19, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.