我想要像 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/