LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > General > Rewritecond for vhost directory?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-05-2011, 06:02 PM
skcsknathan001 skcsknathan001 is offline
New Member
 
Join Date: Dec 2010
Posts: 8
Default Rewritecond for vhost directory?

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
Reply With Quote
  #2  
Old 01-06-2011, 12:08 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,295
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
Reply With Quote
  #3  
Old 01-06-2011, 12:02 PM
skcsknathan001 skcsknathan001 is offline
New Member
 
Join Date: Dec 2010
Posts: 8
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
Reply With Quote
  #4  
Old 01-06-2011, 03:45 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,390
$VH_NAME can not be used in Rewrite Rules directly. You can use
Quote:
%{DOCUMENT_ROOT}
if all the vhosts docroot follow the pattern /home/$VH_NAME/public_html.
Reply With Quote
  #5  
Old 01-07-2011, 09:18 PM
skcsknathan001 skcsknathan001 is offline
New Member
 
Join Date: Dec 2010
Posts: 8
Thanks that's good.

I'll try that
Reply With Quote
Reply

Tags
$vh_name

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:51 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.