Custom Error Page When Entering Nonexistent Url

Good day!

I have a custom error page:

In mod_rewrite:


In absolute path:


When I tried to enter something like this:

The custom error page works, but when I tried this:

It will be redirected to the default error page of litespeed.

Here is the code I am using in .htaccess:

ErrorDocument 404 /404/

What is the reason? I want all errors to redirect to my custom error page, thank you.


regarding absolute path, can you further confirm, it's relative to document root or absolute path on file system.

for example, in .htaccess
ErrorDocument 404 /my-path-to/404.php
it should be relative path to document root, its absolute path in file system maybe /home/user/public_html/my-path-to/404.php

I need more detail(code snippet) about your .htaccess so that I can see if can reproduce on our lab.
When entering a nonexistent url

This code not works:

ErrorDocument 404 /404/

While this code works

ErrorDocument 404 /my-path-to/404.php

Note: I already rewrited the /my-path-to/404.php into /404/ before I use it in ErrorDocument