B
B
Billy Milligan2014-02-10 14:52:38
PHP
Billy Milligan, 2014-02-10 14:52:38

Custom error page 400,401,403,404 etc?

I make a redirect, I registered in .htaccess

ErrorDocument 400 http://mysite.ru/error.php?error=400
ErrorDocument 401 http://mysite.ru/error.php?error=401
ErrorDocument 403 http://mysite.ru/error.php?error=403
ErrorDocument 404 http://mysite.ru/error.php?error=404
ErrorDocument 500 http://mysite.ru/error.php?error=500
ErrorDocument 503 http://mysite.ru/error.php?error=503

In error.php I'm already processing and displaying the corresponding message
. Does the server return error codes or do I need to set them?
How are search engines reacting to this?
switch($_GET['error']) {
    case 404:
        header("HTTP/1.1 404 Not Found");
        break;
} //и т.д

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vit, 2014-02-10
@fornit1917

Open firebug and look at the response headers.

Y
Yakov Akulov, 2014-02-10
@jakulov

Apache will first give the redirect header
httpd.apache.org/docs/2.2/mod/core.html#errordocument
and then you need to give yours in the code

H
Halfi, 2014-02-10
@Halfi

50x errors will not be handled in a mess! 503 for example, nginx returns when the puff daemon is turned off (or has fallen). In this case, how can the handler process the code if it is turned off?

I
Ivan Somov, 2014-02-10
@jsom

IMHO is better without GET, for example,
and there is a separate view under it or whatever you have

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question