【问题标题】:How to migrate an htaccess file from CodeIgniter 3.0.6 to 3.1.6?如何将 htaccess 文件从 CodeIgniter 3.0.6 迁移到 3.1.6?
【发布时间】:2017-09-27 16:43:16
【问题描述】:

我有一个.htaccess 文件,它可以在 CodeIgniter 3.0.6 版中正常工作。当我迁移到 CodeIgniter 3.1.6 版时,此 htaccess 不起作用,网页显示

404 页面未找到

RewriteEngine On

RewriteCond $1 !^(index\.php|images|uploads|install|user_guide|assets|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [PT,L]

【问题讨论】:

标签: php apache .htaccess codeigniter


【解决方案1】:

您的 404 错误很可能与您的 htaccess 文件无关,并且您说在将 CI 框架升级到 3.1.6 之前运行良好

如文档中所述,从 3.0.6 升级到 3.1.6。至少需要 PHP 5.6。在你的评论中你说使用 5.5.19

在这里查看一些详细信息:Upgrading from 3.0.6 to 3.1.0

【讨论】:

    【解决方案2】:

    我会将以下内容放入您的 .htaccess 中,删除 PT 标志:

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

    更多信息可以在in the documentation here找到。

    【讨论】:

    • 谢谢@nicholas,还是没有找到我
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-04
    • 2011-07-25
    • 2022-10-13
    • 2018-03-18
    • 2016-03-08
    • 1970-01-01
    相关资源
    最近更新 更多