RewriteEngine On RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ [NC] RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.mydomain\.com$ [NC] RewriteRule (.*) /forums/$1 [L] Code (markup): If someone could convert that to nginx syntax, I'd really appreciate it. Thanks!
#ignored: condition 0 if ($http_host !~* "^www\.mydomain\.com$"){ set $rule_0 2$rule_0; } if ($http_host ~* "^(www\.)?([^\.]+)\.mydomain\.com$"){ set $rule_0 3$rule_0; } if ($rule_0 = "321"){ rewrite /(.*) /forums/$1 last; } I don't know its working properly or not. I have done some conversion for my site using the url http://www.anilcetin.com/convert-apache-htaccess-to-nginx/. Its worked for me
Look here for a good configuration of Nginx https://www.rv89.eu/forum/index.php?/topic/13-setup-nginx-as-http-deamon-with-vhosts/