Rewritecond for vhost directory?

#1
I'm just wondering how to use a variable for vhost directory within my ReWrite Rules

I am using WordPressMU and W3-Total-Cache. W3TC instructs to use some ReWrite rules, which uses the root directory of the vhost

like

RewriteCond /home/apset/public_html/wp-content/w3tc-%{ENV:DOMAIN}/pgcache/$1/_default_.html%{ENV:APPEND_EXT} -f

where "apset" is the directory of the vhost. Now I have different directory with WP installations. I want to put a variable there so the RewriteCond is same for all my directory installation. I'm wondering, how to use the $VH_NAME in it?

Please give me direction.

here is the full Rewrite rules

# BEGIN W3 Total Cache
<IfModule mod_setenvif.c>
SetEnvIfNoCase Host ^(www\.)?([a-z0-9\-\.]+\.[a-z]+)\.?:)[0-9]+)?$ DOMAIN=$2
SetEnvIfNoCase Accept-Encoding (gzip|deflate) APPEND_EXT=.$1
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} \/$
RewriteCond %{REQUEST_URI} !(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register).php|wp-.*\.php|index\.php) [OR]
RewriteCond %{REQUEST_URI} (wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php) [NC]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|wordpress_\[a\-f0\-9\]\+|wordpress_logged_in) [NC]
RewriteCond %{HTTP_USER_AGENT} !(bot|ia_archive|slurp|crawl|spider) [NC]
RewriteCond /home/apset/public_html/wp-content/w3tc-%{ENV:DOMAIN}/pgcache/$1/_default_.html%{ENV:APPEND_EXT} -f
RewriteRule (.*) wp-content/w3tc-%{ENV:DOMAIN}/pgcache/$1/_default_.html%{ENV:APPEND_EXT} [L]
</IfModule>
# END W3 Total Cache
 

NiteWave

Administrator
#2
please try:
Code:
# BEGIN W3 Total Cache
RewriteEngine On

RewriteCond %{REQUEST_URI} \/$ [OR]
RewriteCond %{REQUEST_URI} !(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register).php|wp-.*\.php|index\.php) [OR]
RewriteCond %{REQUEST_URI} (wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php) [NC]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|wordpress_\[a\-f0\-9\]\+|wordpress_logged_in) [NC]
RewriteCond %{HTTP_USER_AGENT} !(bot|ia_archive|slurp|crawl|spider) [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond /home/apset/public_html/wp-content/w3tc-%{HTTP_HOST}/pgcache/$1/_default_.html.gzip -f
RewriteRule (.*) wp-content/w3tc-%{HTTP_HOST}/pgcache/$1/_default_.html.gzip [L]
# END W3 Total Cache
 
#3
Thanks for the help.

There is still one issue pending. My vhost directory is still hard coded in the RewriteCond "apset". I want to put a variable in there so I can use a vhost template for all my sites which have different directories but will have the exact same rewrite rules from above. The variable within LiteSpeed "$VH_NAME".. can I use that? or how should I use that in the RewriteCond?

Thanks
 
Top