php - 如何从 Codeigniter 4 中的 url 中删除 public/index.php/

标签 php codeigniter-4

我想要像 www.sample.com/controller 这样的普通 URL不是 www.sample.com/public/index.php/controller .

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

我的 .htaccess 文件

最佳答案

做就是了

第一步:在 public/目录下,将 index.php 和 .htaccess 复制到你的项目根目录。

第二步:在项目根目录下,打开 index.php 并编辑以下行:

index.php -> $pathsPath = FCPATH 。 '../app/Config/Paths.php';



index.php => $pathsPath = FCPATH 。 'app/Config/Paths.php';

关于php - 如何从 Codeigniter 4 中的 url 中删除 public/index.php/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48376090/

相关文章:

php - 数据馈送至 MySQL

php - 在 Codeigniter4 中找不到类 'App\Model\Users'

php - 无法在 MACOS Ventura 中安装 php intl 扩展

codeigniter - 解密显示错误认证失败

php - ErrorException 试图获取非对象的属性 'kode_buyer'

javascript - 分页效果不好

php - cakephp2.X 编辑 View 验证

php - Codeigniter 回显 [::1] 而不是 localhost

php - 静态数组中的静态变量

php - 通过ajax返回的javascript代码,但不显示