[CakePHP] Rewrite rule not work

Hello, I just installed CyberPanel. Then I uploaded my website created from CakePHP. Previously I tested with Apache and it worked perfectly. But it turns out that my website doesn’t work on CyberPanel, all pages are error 404 Not found, even the main page.

This is the configuration that I use

RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]

RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

I have followed this guide:

and this

Thank you for the help

If you are on CyberPanel version 1.7.1 please try:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^(\\.well-known/.*)$ $1 [L]
    RewriteRule    ^$    webroot/    [L]
    RewriteCond %{ORG_REQ_URI} !/.filemanager
    RewriteRule   (.*) webroot/$1 
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . /webroot/index.php [L]
</IfModule>

for prior versions

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^/(\\.well-known/.*)$ $1 [L]
    RewriteRule    ^/$    webroot/    [L]
    RewriteCond %{ORG_REQ_URI} !/.filemanager
    RewriteRule   /(.*) webroot/$1 
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . /webroot/index.php [L]
</IfModule>

I tried all the code above, but it didn’t work. My site is also very slow to use CyberPanel, even though site visitors are very quiet. CPU high 100%.

Server spec

CPU 1x Intel® C2350 (Avoton) 1 CPU - 2C/2T - 1.7 GHz
Memory 4 GB DDR3
Storage 1x 120 GB SSD

Using latest version of CyberPanel.

Do

yum install https://rpms.litespeedtech.com/centos/7/x86_64/RPMS/openlitespeed-1.4.38-1.el7.x86_64.rpm
systemctl restart lsws

Then use exact rules shipped from CakePHP.

Thank you. :+1:
After I checked the error log in /usr/local/lsws/logs/error.log, the problem turned out to be in the CakePHP configuration cache, so I deleted the contents in the folder:
app/tmp/cache/model
app/tmp/cache/persistent
app/tmp/cache/display
I also re-upload and configure the database. Now the problem is gone…