I want to convert from apache rewrite modules to nginx
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteCond %{QUERY_STRING} SELECT(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} UNION(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} UPDATE(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteRule ^([^.]*)/?$ index.php [L]
RewriteRule ^domain/trial/cms$ index/index.php?%{QUERY_STRING} [L]
RewriteCond %{HTTP:Range} ([a-z]+) [NC]
RewriteRule ([0-9_\-]+)flv$ http://www.domain.com [R,L]
RewriteCond %{ENV:byte-ranges-specifier} !^$
RewriteRule ([0-9_\-]+)flv$ http://www.domain.com [R,L]
RewriteCond %{HTTP_USER_AGENT} !^Mozilla/5 [NC]
RewriteCond %{HTTP_USER_AGENT} !^Mozilla/4 [NC]
RewriteCond %{HTTP_USER_AGENT} !^Opera [NC]
RewriteRule ([0-9_\-]+)flv$ http://www.domain.com [R,L]
RewriteRule ^$ index/index.php?%{QUERY_STRING} [L]
RewriteCond %{SCRIPT_FILENAME} !sss.php [NC]
RewriteCond %{SCRIPT_FILENAME} !m-administrator [NC]
RewriteRule ^([^/^.]*)$ sss.php?encrypted=$1&%{QUERY_STRING} [L]
RewriteCond %{SCRIPT_FILENAME} !sss.php [NC]
RewriteCond %{SCRIPT_FILENAME} !m-administrator [NC]
RewriteRule ^([^/^.]*)/([^/^.]*)$ sss.php?tab=$1&page=$2&%{QUERY_STRING} [L]
RewriteCond %{SCRIPT_FILENAME} !sss.php [NC]
RewriteCond %{SCRIPT_FILENAME} !m-administrator [NC]
RewriteRule ^([^/^.]*)/([^/^.]*)/([^.]*)$ sss.php?tab=$1&page=$2&queryString=$3&%{QUERY_STRING} [L]
RewriteCond %{SCRIPT_FILENAME} !sss.php [NC]
RewriteCond %{SCRIPT_FILENAME} !security.php [NC]
RewriteRule ^([^/]*)$ index/$1?%{QUERY_STRING} [L]
I tried to convert it by online tools such as : http://www.anilcetin.com/convert-apache-htaccess-to-nginx/ but it didn't convert it correctly. The conversion output is :
if ($args ~ "mosConfig_[a-zA-Z_]{1,21}(=|%3D)"){
set $rule_0 1;
}
if ($args ~ "base64_encode.*(.*)"){
set $rule_0 1;
}
if ($args ~* "(<|%3C).*script.*(>|%3E)"){
set $rule_0 1;
}
if ($args ~ "GLOBALS(=|[|%[0-9A-Z]{0,2})"){
set $rule_0 1;
}
if ($args ~ "_REQUEST(=|[|%[0-9A-Z]{0,2})"){
set $rule_0 1;
}
if ($args ~ "SELECT(=|[|%[0-9A-Z]{0,2})"){
set $rule_0 1;
}
if ($args ~ "UNION(=|[|%[0-9A-Z]{0,2})"){
set $rule_0 1;
}
if ($args ~ "UPDATE(=|[|%[0-9A-Z]{0,2})"){
set $rule_0 1;
}
if ($rule_0 = "1"){
rewrite ^/([^.]*)/?$ /index.php last;
}
if ($rule_1 = ""){
rewrite ^/domain/trial/cms$ /index/index.php?$args last;
}
if ($http_range ~* "([a-z]+)"){
set $rule_2 1$rule_2;
}
if ($rule_2 = "1"){
rewrite /([0-9_-]+)flv$ http://www.domain.com redirect;
}
#ignored: condition 0
if ($rule_3 = "1"){
rewrite /([0-9_-]+)flv$ http://www.domain.com redirect;
}
if ($http_user_agent !~* "^Mozilla/5"){
set $rule_4 1$rule_4;
}
if ($http_user_agent !~* "^Mozilla/4"){
set $rule_4 2$rule_4;
}
if ($http_user_agent !~* "^Opera"){
set $rule_4 3$rule_4;
}
if ($rule_4 = "321"){
rewrite /([0-9_-]+)flv$ http://www.domain.com redirect;
}
if ($rule_5 = ""){
rewrite ^/$ /index/index.php?$args last;
}
if ($uri !~* "sss.php"){
set $rule_6 1$rule_6;
}
if ($uri !~* "m-administrator"){
set $rule_6 2$rule_6;
}
if ($rule_6 = "21"){
rewrite ^/([^/^.]*)$ /sss.php?encrypted=$1&$args last;
}
if ($uri !~* "sss.php"){
set $rule_7 1$rule_7;
}
if ($uri !~* "m-administrator"){
set $rule_7 2$rule_7;
}
if ($rule_7 = "21"){
rewrite ^/([^/^.]*)/([^/^.]*)$ /sss.php?tab=$1&page=$2&$args last;
}
if ($uri !~* "sss.php"){
set $rule_8 1$rule_8;
}
if ($uri !~* "m-administrator"){
set $rule_8 2$rule_8;
}
if ($rule_8 = "21"){
rewrite ^/([^/^.]*)/([^/^.]*)/([^.]*)$ /sss.php?tab=$1&page=$2&queryString=$3&$args last;
}
if ($uri !~* "sss.php"){
set $rule_9 1$rule_9;
}
if ($uri !~* "security.php"){
set $rule_9 2$rule_9;
}
if ($rule_9 = "21"){
rewrite ^/([^/]*)$ /index/$1?$args last;
}
Please help me with the proper conversion result for nginx in order to work perfectly.