[英]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 了。
所以我的問題是:
簡要說明也會有所幫助。 謝謝!
我希望這能幫到您。 只需將 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.