[英]Migration failed from htaccess to nginx configuration
I'm in process of migration from .htaccess to nginx.conf file but after migration rules doesn't work as I expected.我正在从 .htaccess 迁移到 nginx.conf 文件,但迁移规则没有按我预期的那样工作。 This is content of .htaccess that I'm gonna migrato to nginx.
这是我要迁移到 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]
And this is content of nginx.conf that I've migrated:这是我迁移的 nginx.conf 的内容:
index index.php
location / {
rewrite ^(.*)$ /index.php?$1 break;
}
Please let me know what's wrong with this and how can I get nginx conf file works.请让我知道这有什么问题,以及如何使 nginx conf 文件正常工作。
Regards.问候。 Yuming
玉明
Those .htaccess
statements perform a similar function to the Nginx try_files
directive.这些
.htaccess
语句执行类似于 Nginx try_files
指令的功能。
Try:尝试:
location / {
try_files $uri $uri/ /index.php?$uri;
}
See this document for details.有关详细信息,请参阅此文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.