【发布时间】:2020-03-07 19:35:43
【问题描述】:
我正在尝试将我的服务器移至 Nginx 以进行试用。但是,当我将 htaccess 代码传输到 conf 文件时,出现 404 错误。如何让 Nginx 下面的代码重写兼容?
RewriteEngine on
RewriteRule ^firmaekle\.html$ /firmaekle.php [L,QSA,R=301]
RewriteRule ^/d/([^/]*).([^/]*)\.html$ /index.php?site=$1&site2=$2 [L,QSA,R=301]
RewriteRule ^u/([^/]*)([^/]*)\.html$ /uzgun.php?site=$1&site2=$2 [L,QSA,R=301]
RewriteRule ^y/([^/]*)([^/]*)\.html$ /yonlendir.php?firma=$1&uzanti=$2 [L,QSA,R=301]
RewriteRule ^ye/([^/]*)([^/]*)\.html$ /yonlendir2.php?firma=$1&uzanti=$2 [L,QSA,R=301]
【问题讨论】:
-
这个规则集非常简单,您可以放心地使用一些自动转换器。 One of the best 由 Danila Vershinin 编写。
-
404 错误仍然存在,即使我添加了重写代码gist.github.com/EmreKara5aya/ca67b906d623d5b10c97745a620aabce