简体   繁体   English

在 Wordpress 中安装 CodeIgniter4

[英]Installing CodeIgniter4 inside Wordpress

So i want to add a crud system with CI4 to an existing wordpress site.所以我想在现有的 wordpress 站点中添加一个带有 CI4 的 crud 系统。 So I moved my CI4 inside my website root folder.所以我将我的 CI4 移动到我的网站根文件夹中。 Looks like this看起来像这样

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

The problem is I cant access the project.问题是我无法访问该项目。 It supposed to be in mywebsite.com/project (right?).它应该在 mywebsite.com/project 中(对吗?)。 The page says页面说

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

I already change the following line in App.php in project/app/config我已经在 project/app/config 中的 App.php 中更改了以下行

public $baseURL = 'mywebsite.com/';

So I search about this problem and found out few articles about wordpress .htaccess prevent this.所以我搜索了这个问题,发现很少有关于 wordpress .htaccess 的文章可以防止这个问题。 I tried to change the .htaccess in wordpress from我试图将 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>

to this one对这个

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

but i realize that ci4 dont have index.php in the main folder anymore.但我意识到 ci4 在主文件夹中不再有 index.php 了。

so my questions are:所以我的问题是:

  1. For the ci4 configuration, what i need to change in ci4 files other than the line in app.php above?对于 ci4 配置,除了上面 app.php 中的行之外,我需要在 ci4 文件中更改什么?
  2. For the 404 Forbidden problem (I'm guessing it has something to do with .htaccess)对于 404 Forbidden 问题(我猜它与 .htaccess 有关)
  3. Any suggestions to make this work, even if it has nothing to do with the .htaccess任何使这项工作的建议,即使它与 .htaccess 无关

a briefly explanation will help too.简要说明也会有所帮助。 Thanks!谢谢!

I hope this will help you.我希望这能帮到您。 Just move the index.php and the .htaccess file in the public folder to ci4 root folder and then open the index.php file and edit this line只需将 public 文件夹中的 index.php 和 .htaccess 文件移动到 ci4 根文件夹,然后打开 index.php 文件并编辑这一行

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

To

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

I hope this help else call my attentions我希望这有助于引起我的注意

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

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