I
I
Irek Sitdikov2015-03-07 00:41:31
Network administration
Irek Sitdikov, 2015-03-07 00:41:31

Can I set the default 404 error page for the entire server?

In case the site I have on the server does not have the appropriate directive for the error.
Accordingly, for other types of errors.
I have an Apache2 web server. I tried to solve the problem myself, but there were difficulties.
If you write the following directive in the conf.file with the public file error.php:

<Directory "/var/www/example.ru/public_html">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        		ErrorDocument 404 example.ru/error.php
</Directory>

Then on the page I simply see "example.ru/error.php" as text.
If you write a directive in a conf. file with a non-public file /var/www/error.php:
<Directory "/var/www/example.ru/public_html">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        		ErrorDocument 404 /var/www/error.php
</Directory>

The error is displayed:
"Additionally, a 404 not found error was encountered while trying to use an errordocument to handle the request."
I would like to know what exactly is wrong with me and how to do it right in general. And as already indicated in the title of the question, to do this by default, so as not to produce in all configuration files. Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
NeSViT, 2015-03-07
@NeSViT

Error on the way, no?
Options Indexes FollowSymLinks MultiViews
AllowOverride All

S
sbh, 2015-11-17
@sbh

Similar problem.
If you make an .htaccess file in a subfolder of the site and do not explicitly write the path to 404 or 403 or some other error in it *full path to the error page) then we get an error Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
If the path is written in full, then the error page opens as it should.
It turns out that you need to prescribe the full path in each folder or something to make it work ???

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question