在我的灯安装,我已经在根文件夹“/”(mydomain.org)W3总caching激活wordpress多站点,我也有一个sub_dir称为“ 子 ”(mydomain.org/sub)与PHP脚本里面。
我有一些sub_dircaching问题,所以我想设置一个RewriteRule从我的sub_dir中排除W3总caching ,问题是,我只有这方面的基本知识。
... # 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>
你可以定义一个RewriteCond条件来排除根htaccess中的子path。
这将是这样的(没有testing)
... # 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 ...