[CakePHP] Rewrite rule not work

edited September 9 in Web Server
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:
https://docs.cyberpanel.net/doku.php?id=rewrite-rules
and this
https://blog.cyberpanel.net/2018/04/07/how-to-write-rewrite-rules-for-openlitespeed/

Thank you for the help
Tagged:
Tagged:

Comments

  • If you are on CyberPanel version 1.7.1 please try:

    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]
    for prior versions

    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]
  • 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.
  • edited September 10
    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..
Sign In or Register to comment.
Support CyberPanel CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!