gpt4 book ai didi

.htaccess - 从 htaccess 迁移到 nginx 配置失败

转载 作者:行者123 更新时间:2023-12-04 18:44:47 24 4
gpt4 key购买 nike

我正在从 .htaccess 迁移到 nginx.conf 文件,但是在迁移规则后没有按我预期的那样工作。
这是我要迁移到 nginx 的 .htaccess 的内容。

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|assets)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]

这是我迁移的 nginx.conf 的内容:
index index.php

location / {
rewrite ^(.*)$ /index.php?$1 break;
}

请让我知道这有什么问题以及如何使 nginx conf 文件正常工作。

问候。 Jade 明

最佳答案

那些.htaccess语句执行与 Nginx try_files 类似的功能指示。

尝试:

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

this document详情。

关于.htaccess - 从 htaccess 迁移到 nginx 配置失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53163222/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com