.htaccess 将htaccess重写规则转换为Nginx问题

.htaccess 将htaccess重写规则转换为Nginx问题,.htaccess,mod-rewrite,nginx,.htaccess,Mod Rewrite,Nginx,我需要帮助将以下htaccess规则转换为Nginx AddHandler php5-script .php .html .html AddType text/html .php .html .html Opt0ions -Indexes ErrorDocument 403 /index.php RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d #RewriteRule ^

我需要帮助将以下htaccess规则转换为Nginx

AddHandler php5-script .php .html .html
AddType text/html .php .html .html
Opt0ions -Indexes
ErrorDocument 403 /index.php
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
#RewriteRule ^(.*)$ test.php/$1
RewriteRule ^(.*)$ index.php/$1
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
到目前为止,我有以下内容,但不知道如何在Nginx中实现:

# nginx configuration
error_page 403 /index.php;
autoindex off;
location / {
if ($script_filename !~ "-f"){
rewrite ^(.*)$ /index.php/$1;
}
if ($http_host ~* "^www\.(.*)$"){
rewrite ^(.*)$ http://%1/$1 redirect;
}
}
那是我在一家旅馆改的

上面转换的重写规则正确吗?如何使用Nginx实现这些功能