繁体   English   中英

在 Wordpress 中安装 CodeIgniter4

[英]Installing CodeIgniter4 inside Wordpress

所以我想在现有的 wordpress 站点中添加一个带有 CI4 的 crud 系统。 所以我将我的 CI4 移动到我的网站根文件夹中。 看起来像这样

--web (root folder)
|
 --wp-admin
 --wp-content
 --project (CI4 folder)
 |
  --App
  --...

问题是我无法访问该项目。 它应该在 mywebsite.com/project 中(对吗?)。 页面说

403 Forbidden
You don't have permission to access this resource.

我已经在 project/app/config 中的 App.php 中更改了以下行

public $baseURL = 'mywebsite.com/';

所以我搜索了这个问题,发现很少有关于 wordpress .htaccess 的文章可以防止这个问题。 我试图将 wordpress 中的 .htaccess 从

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

对这个

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /project
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /project/index.php [L]
</IfModule>

但我意识到 ci4 在主文件夹中不再有 index.php 了。

所以我的问题是:

  1. 对于 ci4 配置,除了上面 app.php 中的行之外,我需要在 ci4 文件中更改什么?
  2. 对于 404 Forbidden 问题(我猜它与 .htaccess 有关)
  3. 任何使这项工作的建议,即使它与 .htaccess 无关

简要说明也会有所帮助。 谢谢!

我希望这能帮到您。 只需将 public 文件夹中的 index.php 和 .htaccess 文件移动到 ci4 根文件夹,然后打开 index.php 文件并编辑这一行

require realpath(FCPATH . '../app/Config/Paths.php') ?: FCPATH . '../app/Config/Paths.php';

require realpath(FCPATH . './app/Config/Paths.php') ?: FCPATH . './app/Config/Paths.php';

我希望这有助于引起我的注意

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM