2014-08-29 88 views
0

我需要将这个htaccess文件转换为用于nginx的try_files,但我无法为我的生活做到这一点。有人可以帮忙吗?Nginx,.Htaccess和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

你想在try_files做什么?这里简单的重写应该可以工作。 – 2014-08-29 04:12:46

回答

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; 
+0

谢谢阿列克谢。你救了我的命。 – 2014-09-02 14:16:19