我有这个文件.htaccess for apache:
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
如何将此转换为.htaccess for nginx?
我尝试了这个:
location / {
rewrite ^/$ /index.html;
rewrite / /RewriteRule;
rewrite ^/(.*)$ /index.php last;
}
你认为对吗?
非常感谢!
答案 0 :(得分:0)
您不需要重写这些内容,只需try_files。
try_files /index.html$is_args$args $uri.html$is_args$args $uri /index.php$is_args$args;