php - 代码点火器 | 将 index.php 移至公用文件夹
问题描述
我是 CodeIgniter 的新手,我认为可以尝试一下
- 下载了 CodeIgniter 中可用的代码
- 将基本网址更改为
$config['base_url'] = 'http://localhost:8000';
- 使用命令启动服务器
php -S 0.0.0.0:3000
这很顺利。接下来,我尝试将index.php
文件移动到公共文件夹中——这就是事情开始破裂的时候。
- 将 index.php 移至新创建的公用文件夹
使用以下代码片段创建了一个新文件 public/.htaccess
RewriteEngine on RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png) RewriteCond %(REQUEST_FILENAME) !-f RewriteCond %(REQUEST_FILENAME) !-d RewriteRule ^(.*)$ ./index.php/$1 [L]
修改
$system_path = '../system';
和$application_folder = '../application'
; 在public/index.php
.404 Resource not found
当我在重新启动服务器后尝试访问该页面时,我得到一个,。
解决方案
您是否更改了服务器配置中的根文件夹?
如果您将 index.php 移动到不同的文件夹,您应该在服务器设置中更改了 index.php 的路径。在配置文件中。
推荐阅读
- compiler-construction - 如何使用 JAVACC 中的空词作为标记?
- asp.net-mvc - 在 ICollections 上使用 Html.NameFor
- xml - Ejabberd 和 Python3
- android - Admob 填充率从 ~80% 降至 0%
- java - Hibernate 保存额外的行而不是更新并且需要两次保存
- javascript - 使用 Vanilla JS 和 JSON 文件填充选择元素
- html - 如何根据设备大小操作 iframe css
- html - 如何使css网格只出现在手机上而不出现在桌面上
- ruby-on-rails - 如何在 routes.rb 文件中获取路径,即我当前 api 的路径
- stripe-payments - 条纹嵌入形式:更改邮政编码占位符文本?