Changing XAMPP default error404

1. Edit the following document as root

sudo pico /opt/lampp/etc/extra/httpd-multilang-errordoc.conf

at the end of the file, change the lines as shown i.e. put # to the begginning and add new lines.

ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
#ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
#ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
ErrorDocument 404 /error403.html
ErrorDocument 404 /error404.html
ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var

Save and exit (Ctrl+O, CTRL+X)

2.  Prepare custom error files named error403.html and error403.html. These files should be kept in root of your webserver (ie: opt/lampp/htdocs) directory

3.  Just restart XAMPP by below code.

sudo /opt/lampp/lampp restart

4. With the  XAMPP's new security setting of preventing access to XAMPP and phpmyadmin directories rather than the permitted IP addresses, it will throw the error 403 page. To change this setting, edit the following:

sudo pico /opt/lammp/etc/extra/httpd-xampp.conf

Thus,

change the line below:

ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var

to

ErrorDocument 403 /error404.html

It is not a mistake. Intentionally I recommend you to direct unauthorized visitors requesting to access xampp and phpmyadmin directories to the "page not found" (404) error page. This will be slightly more secure since the attacker may think that there is no xampp or phpmyadmin directory in the server. (that is also the reason of having error404.html not .php file, though you have to enable seo if you use joomla so that it is not too obvious by looking at the address)