【问题标题】:How to Remove index.php from second project of CodeIgniter when two project are in same directory?当两个项目位于同一目录中时,如何从 CodeIgniter 的第二个项目中删除 index.php?
【发布时间】:2018-05-15 09:31:20
【问题描述】:

我在我的单个目录中有两个 CODEIGNITER 项目,为了从 URL 中删除 index.php,我在我的根文件夹中添加了文件 .htaccess,但是当我运行这两个项目时,第一个通过 CONTROLLER 运行,而第二个一个是给我 404 page not found 错误。
我的 .htaccess 文件代码是

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

【问题讨论】:

    标签: .htaccess codeigniter


    【解决方案1】:

    您好,我在一个目录中有两个项目,我的 .htaccess 中的代码如下所示,试试看它是否适合您。

    <IfModule mod_rewrite.c>
         RewriteEngine On
         Options -Indexes
         RewriteCond %{REQUEST_FILENAME} !-f
         RewriteCond %{REQUEST_FILENAME} !-d
         RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>
    

    【讨论】:

      猜你喜欢
      • 2017-08-10
      • 2013-01-08
      • 1970-01-01
      • 1970-01-01
      • 2019-05-17
      • 1970-01-01
      • 2011-05-24
      • 1970-01-01
      相关资源
      最近更新 更多