How to remove the default LiteSpeed server 404 error page?

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!

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Accepted 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.

Best, Eric