【发布时间】:2016-08-31 01:16:02
【问题描述】:
我想将 Apache Web 服务器移动到 ngnix 网络服务器,但是如何将这些 Apache 规则更改为 ngnix。 我的主站点中有一个 .htaccess 文件,在子目录中有一个 .htaccess 文件
主站点 .htacess 重写引擎开启
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^(.*)$ zzz.php?hash=$1 [L]
</IfModule>
在子目录.htacess 规则中
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^(.*)$ host.php?hash=$1 [L,QSA,NC]
</IfModule>
【问题讨论】: