J
J
Jack Daniel's2016-03-30 08:59:06
PHP
Jack Daniel's, 2016-03-30 08:59:06

How is the display of the 404 error page on VK.com implemented?

I will try to formulate the question clearly.
How does VK.com display a 404 error page without a redirect?
It works for them obviously not through htaccess. As far as I understand, first of all, they check through the database whether there is content at such an address. If there is, then we display it, if not, error 404. But when a page with a 404 error is displayed, 8 lines remain from the page code (the same meta tags will not be). How do they "remove" the code of one page while displaying the code of another?
404

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri, 2016-03-30
@Yea_intenet

if rendering is done after receiving the data, then there can be no problems.
and if shit like this

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<?php 
$data = $db->get();
// .... вывод
?>
</body>
</html>

then only output buffering will help to
run ob_start() before the code starts.
and at the end echo ob_get_clean()
then at any time the displayed content can be reset and start displaying another page
ob_clean();

T
Timur Sergeevich, 2016-03-30
@MyAlesya

You don't need a redirect for this. They just dynamically form and send a page like 404 instead of a regular page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question