php - Codeigniter 删除 Nginx 上的 index.php

标签 php .htaccess codeigniter nginx

我正在使用 Codeigniter 框架,我在共享主机上测试了该网站,它与 .htaccess 一起工作正常。但是当我将它上传到其他有 Nginx 的服务器时,我无法删除 index.php。我尝试了几乎所有 googel 的两个第一页,我得到了相同的结果,但没有一个对我有用,我想从 URL 中删除 index.php。这是对我有用的 htaccess。

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [L]

我想在 nginx.config 中对这个 htaccess 进行响应。 我不知道出了什么问题。

最佳答案

这也让我抓狂。

结果证明在 config.php 文件中使用它很有帮助。

$config['uri_protocol'] = 'REQUEST_URI';

我目前也在使用相同的 htaccess 规则

关于php - Codeigniter 删除 Nginx 上的 index.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36096860/

相关文章:

php - Zend Forms - populate() 和 setDefaults()

php - 微小的MCE/PHP : How to retrieve and reinsert BLOB data into the textarea to allow re-editing

.htaccess 为 seo 友好的 url 重写 url 会导致 500 错误

apache - 使用 .htaccess 重定向域后的所有内容

apache - 基于http状态码的rewritecond

css - 使用 Bootstrap 的中心图像 CRUD 库

mysql - 在 codeigniter 中将 Controller 中的值作为 JSON 传递以查看 Angular Js 上包含的内容

javascript - 当选中复选框时,值(value)价格不会转换

php - 将字符串转换为 SHA1 和 base64

mysql - 基于codeigniter和sql中的类别计算单词