How to exclude a sub-folder from WordPress control?

How to exclude a sub-folder from WordPress control?

Here is a quick fix for those who have come across this problem and looking for a solution to stop WordPress from redirecting.

If you have WordPress website with a sub folder that needs to be outside the control of WordPress then this little fix will get rid of your headache.

This requires editing the .htaccess file either from your ftp account/cpanel or via the WordPress dashboard with admin login. If you don’t know how to edit your .htaccess file from within your WordPress then search for plugins that allow you to edit this file.

It is a simple change and most websites have already a default .htaccess file.
Within the htaccess file locate the following code:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Change the following line from this

RewriteRule . /index.php [L]

To

RewriteRule ./ /index.php [L]

and that is pretty much all you need to do. It was a life saver for me.
I wanted to use this so that I can password protect a private use folder.
I use this particular folder to store personal documents that I can view from any place or computer and I need to provide valid user login details.
If you’re using CPANEL you can set this up in the “Directory Privacy” icon.

Have a great day!