2011-12-04 91 views
1

我有用于Apache这个文件的.htaccess:翻译的Apache2重写规则

# 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的nginx的?

我tryed这一点:

location/{ 
    rewrite ^/$ /index.html; 
    rewrite//RewriteRule; 
    rewrite ^/(.*)$ /index.php last; 
    } 

你认为正确的吗?

非常感谢!

回答

0

你不需要重写这些东西,只需要try_files

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