当我尝试将htaccess转换为nginx文件时出现问题,触发下载



如何将此.htaccess转换为NGINX?

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .(js|css|jpeg|jpg|gif|png|ico|map)(?|$) /404error.php [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

我试过这个:

location / {
try_files $uri $uri/ /index.php?$args;
}

但是当我单击指向其他地址的另一个链接时,它总是触发下载一个名为download的文件

这是普通网址的一个例子http://forum.example.net/index.php?/discover/

应该如何:http://forum.example.net/discover/

我正在使用 ipboard v4.4.10

尝试添加 PHP 位置块

location ~ .php$ {
...
include fastcgi_params;
fastcgi_pass php;
}

参考:Nginx提供.php文件作为下载,而不是执行它们

最新更新