0
我在创建一个匹配Nginx上的.htaccess的重写规则时遇到了问题,我希望有人能指出我正确的方向。Nginx重写多个查询参数
我的.htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt|app|assets|upload|api)
RewriteRule ^([^/]+)(?:/([^/]+)|)(?:/([^/]+)|)(?:/([^/]+)|) index.php?class=$1&action=$2¶m=$3 [L]
我的nginx的配置
location/{
rewrite ^/([^/]+)(?:/([^/]+)|)(?:/([^/]+)|)(?:/([^/]+)|) /index.php?class=$1&action=$2¶m=$3 break;
}
查询参数是可选的,例如:
site.com/
site.com/customers
site.com/customers/add
site.com/customers/edit/1
我不能重写,因为IAM只能从Apache的迁移应用程序代码到nginx。
任何帮助将不胜感激。
谢谢。