php – apache .htaccess到nginx重写规则
我需要从apache更改为Nginx,但.htaccess不能在Nginx服务器上运行. 我在我的Apache .htaccess中得到了以下内容: RewriteEngine On # always run through the indexfile RewriteRule .$index.php # don't let people peek into directories without an index file Options -Indexes 当我在Nginx服务器上放置.htaccess时,服务器会删除该文件. 我希望所有子目录文件都通过我的index.php文件,所以我可以包含我的index.php文件中的特定文件… 我尝试过类似的东西: # nginx configuration autoindex off; location / { rewrite .$/index.php; } 但它不起作用.该目录看起来像: ── root ├── folder1 │ └── folder2 │ └── file.php └── index.php 所以,如果我要求root / folder1 / folder2 / file.php我希望服务器加载root / index.php,因为我仍然有服务器url请求, 这一切都适用于我的apache安装,但不适用于Nginx服务器. # 编辑: # nginx configuration autoindex off; location / { rewrite .* /index.php last; } (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |