How to exclude a subfolder from .htaccess
I'm using the plugin User Access Manager 开发者_开发百科to restrict access to the folder uploads in a Wordpress site. This folder is located at example.com/wp-content/uploads/. The plugin has written this .htaccess in that folder:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule (.*) /index.php?uamfiletype=attachment&uamgetfile=$1 [L]
</IfModule>
In that folder (/wp-content/uploads/) there is also a folder called wpsc (/wp-content/uploads/wpsc/) with the files of the shop of the site. Right now the .htaccess is working fine, but it's restricting the wpsc folder too. I need to add an exception so the wpsc folder can be accessed by everybody.
Place a .htaccess file in the wpsc/ folder with the content:
<IfModule mod_rewrite.c>
RewriteEngine Off
RewriteBase /
</IfModule>
This overrules the rewriterule in the .htaccess file in the parent folder
This works for the plugin WP Photo Album Plus, i.c. the ../wp-content/uploads/wppa/ folder.
You can inspect the matched string with a RewriteCond
:
RewriteCond $1 !^wpsc/
RewriteRule (.*) /index.php?uamfiletype=attachment&uamgetfile=$1 [L]
精彩评论