php - how should I use output of conversion of htaccess rewrite rules to nginx rewrite rules -
i use neginx, need convert htaccess rewrite rules neginx rewrite rules. used this converting. want know how should use of output ?
.htaccess:
rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?rt=$1 [l,qsa] errordocument 404 /error404.html
nginx rules: (the output)
if (!-f $request_filename){ set $rule_0 1$rule_0; } if (!-d $request_filename){ set $rule_0 2$rule_0; } if ($rule_0 = "21"){ rewrite ^/(.*)$ /index.php?rt=$1 last; }
how should use of output ?
it should noted have multiple .htaccess in different folders (3 .htaccess files in 3 different folder)
in nginx, there no such thing htaccess file. of nginx rules need go directly nginx config file.
see: http://nginx.org/en/docs/beginners_guide.html#conf_structure
what you'll need because htaccess files in different folders need wrap rules in location
blocks.
so example, if rules posted translated htaccess file in "blogs" folder, you'd this:
location /blogs/ { if (!-f $request_filename){ set $rule_0 1$rule_0; } if (!-d $request_filename){ set $rule_0 2$rule_0; } if ($rule_0 = "21"){ rewrite ^/(.*)$ /index.php?rt=$1 last; } }
Comments
Post a Comment