На моей установке лампы я имею в корневой папке "/" (mydomain.org) Wordpress, многоузловой с общим активированным кэшем W3, у меня есть также sub_dir, названный "sub" (mydomain.org/sub) со Сценарием PHP внутри.
У меня есть некоторые проблемы кэша на sub_dir, таким образом, я хочу установить RewriteRule для исключения общего кэша W3 из моего sub_dir, проблема состоит в том, что у меня есть только элементарные знания об этом.
...
# BEGIN W3TC Minify cache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^[_0-9a-zA-Z-]+/wp-content/cache/minify/[0-9]+/w3tc_rewrite_test$ /wp-content/plugins/w3-total-cache/pub/minify.php?w3tc_rewrite_test=1 [L]
</IfModule>
# END W3TC Minify cache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
Options -Indexes +FollowSymLinks
RewriteEngine On
php_flag opcache.enable Off
RewriteBase /sub_dir
# exclude any paths that are not codeigniter-app related
RewriteCond %{REQUEST_URI} !^/server-status
RewriteCond %{REQUEST_URI} !^/server-info
RewriteCond %{REQUEST_URI} !^/docs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
# the following is for rewritting under FastCGI
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
Anda boleh menentukan syarat RewriteCond untuk mengecualikan sub jalan dalam root htaccess.
Ia akan menjadi seperti ini (tidak diuji)
...
# BEGIN W3TC Minify cache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/sub
RewriteRule ^[_0-9a-zA-Z-]+/wp-content/cache/minify/[0-9]+/w3tc_rewrite_test$ /wp-content/plugins/w3-total-cache/pub/minify.php?w3tc_rewrite_test=1 [L]
</IfModule>
# END W3TC Minify cache
...