i have this file .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]
how can i convert this to .htaccess for nginx ?
i tryed with this :
location / {
rewrite ^/$ /index.html;
rewrite / /RewriteRule;
rewrite ^/(.*)$ /index.php last;
}
you think correct ?
Thanks very much!
您不需要重写此类内容,只需要try_files即可 。
try_files /index.html$is_args$args $uri.html$is_args$args $uri /index.php$is_args$args;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.