How to remove the default LiteSpeed server 404 error page?

Posted November 7, 2019 9.3k views
OpenLiteSpeed WordPress 1-Click

I’m having a strange behavior on my OpenLiteSpeed Wordpress server.
If for example I’m pointing to https://mywebsite/wp-content/uploads/2019/ I’m seeing the default litespeed 404 error page, but if I’m pointing to a non existent file/folder on my server, I’ll see my wordpress 404 custom error page.

So how can I remove the default litespeed 404 error page so that I can only use my custom one?

I have also removed the /usr/local/lsws/Example/html/error404.html and deleted my browser’s cache but still no change.

Any help is appreciated. Thank you!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi @komi ,

Getting an OpenLiteSpeed 404 page from https://mywebsite/wp-content/uploads/2019/ is due to there’s no index file exist.

You can fix it by (wiki):

  1. Access to web admin at port 7080
  2. Click Virtual Hosts > wordpress > General.
  3. You should see there’s a Customized Error Pages section in the middle of the page. Click Add and choose 404 Not Found as your Error Code and your costumed error page to URL location.
  4. Click Graceful Restart button to make it works.

There’s another solution which I am not recommended which is by setting Auto Index to Yes from Virtual Hosts > wordpress > General > Index Files

Non-exist folder/file return you a correct 404 page is possibly due to hit below example rewrite rules and then rewrite to an index file automatically. In this case, you may hit the back-end PHP and return you the custom/correct 404 page.

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

FYI, OpenLiteSpeed has a 404 page built-in the code so even deleting the file it will still show.


  • Thanks a lot for your suggestion. I had hard times accessing that panel not just by allowing the port on my firewall but I had to type also ufw allow 7080 and also create the user ( I thought it was the root ) by accessing /usr/local/lsws/admin/misc/ .

    Finally I’ve changed what you suggested but I have no idea how am I suppose to point it to my wordpress error page as it’s in my custom theme and not a static html page. Can’t we just completely remove the 404 function and let only wordpress to do the job?

    • Hello,

      nah, it’s an “admin” user.
      It’s due to no index, not because of the 404 function there.
      You can try adding like “index.php” which should do the trick.


      • I’m having both in:

        Use Server Index Files: No
        Index Files:    index.php index.html

        Maybe I should switch use server index to Yes?

        • You said “Finally I’ve changed what you suggested but I have no idea how am I suppose to point it to my wordpress error page as it’s in my custom theme and not a static html page.”, and you actually can just try to put an index.php there see if it helps.

          • What I meant by that is that I typed mysite/404.php even though that page doesn’t exist but it shows my custom error page..strange, I know. Anyway, thanks a lot for your help.