Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
翻译apache2重写规则_Apache_Nginx_Rewrite - Fatal编程技术网

翻译apache2重写规则

翻译apache2重写规则,apache,nginx,rewrite,Apache,Nginx,Rewrite,我有一个apache的.htaccess文件: # 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 ^(.*)$ ind

我有一个apache的.htaccess文件:

# 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;
  }
你认为正确吗


非常感谢

这样的事情不需要重写,只需要修改一下

try_files /index.html$is_args$args $uri.html$is_args$args $uri /index.php$is_args$args;