<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.6000.17097" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have difficulty converting these rewrite rules of
apache into nginx. Could someone please provide a helping hand. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>RewriteRule
^(.*)$
%{SERVER_NAME}$1
[C]</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>RewriteCond
%{SERVER_NAME}
^(.*)\.example\.com$</FONT></DIV>
<DIV><FONT face=Arial size=2>RewriteRule
^([a-z0-9-]+)\.example\.com/(.*)$
/home/www/$1/$2
[L]</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>so if i go to test.example.com it should redirect
me to /home/www/test/index.php|html</FONT></DIV>
<DIV><FONT face=Arial size=2>etc.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>but in nginx somehow I get <FONT
face="Times New Roman">2011/06/16 05:31:15 [error] 28649#0: *1 open()
"/home/www///</FONT></FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>it somehow does not recognize variables.</DIV>
<DIV> </DIV>
<DIV> server_name ~^(.*)$;</DIV>
<DIV> </DIV>
<DIV> if ( $host ~ ^(.*)\.example\.com$
) {<BR> rewrite
^([a-z0-9-]+)\.example\.com/(.*)$
/home/www/$1/$2 last;</DIV>
<DIV>}<BR></DIV>
<DIV>root /home/www/$1/$2</DIV></FONT>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Sincerely,</FONT></DIV>
<DIV><FONT face=Arial size=2>Arvydas</FONT></DIV></BODY></HTML>