Nginx,.Htaccess和try_files

时间:2014-08-29 01:20:57

标签: .htaccess nginx

我需要将此htaccess文件转换为nginx的try_files,但我不能在我的生命中这样做。有人可以帮忙吗?

Options +FollowSymlinks
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^img-(.*)\.html img.php?id=$1 [L]
RewriteRule ^slide-(.*)\.html slider.php?id=$1 [L]
RewriteRule ^page-(.*)\.html page.php?name=$1 [L]
RewriteRule ^contact\.html$ contact.php [QSA,L,NC]

1 个答案:

答案 0 :(得分:0)

你在这里不需要try_files:

rewrite ^/img-(.*).html$ /img.php?id=$1 last;
rewrite ^/slide-(.*).html$ /slider.php?id=$1 last;
rewrite ^/page-(.*).html$ /page.php?name=$1 last;
rewrite ^/contact.html$ /contact.php last;