[英]Migration failed from htaccess to nginx configuration
我正在从 .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 文件正常工作。
问候。 玉明
这些.htaccess
语句执行类似于 Nginx try_files
指令的功能。
尝试:
location / {
try_files $uri $uri/ /index.php?$uri;
}
有关详细信息,请参阅此文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.