nginx重写下载而不是打开php文件

时间:2014-05-03 08:58:04

标签: mod-rewrite nginx

我将这些行添加到nginx中的virtual.conf中。重定向工作正常,但它下载文件而不是打开它。

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;

我试图将此.htaccess翻译为nginx:

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]

2 个答案:

答案 0 :(得分:0)

我猜...没有安装PHP? 我会尝试用PHP info命令显示一个简单的页面。在这种情况下,谈论执行不打开可能更好。

答案 1 :(得分:0)

nginx很老了。我需要更新它。