Wrote a script site, addresses of the following type Vasya.ru / 1234567
I looked for the search, a bunch of non-existing pages of the Vasya.ru / contact.html Vasya.ru / contact / appeared and many other options, while the page actually does not exist, but the code 200 is given.
The .htaccess file looks like this
## Application Handler RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)?$ 2.php?a=$1 [QSA,NC,L] ## Error 404 ## ErrorDocument 404 /index.php?a=404 How to teach the script to expose 404 error on non-existing pages?
The site itself is formed using cURL requests , because of this, many non-existing pages appear ...
Help to understand, thanks!
Added after the script that displays the result using echo $ postResult; code ...?> <?php header('HTTP/1.0 404 Not Found'); ?> ...?> <?php header('HTTP/1.0 404 Not Found'); ?> now 404 is given to the server. But if there is a page, an error message appears - the header has already been transmitted ie 404 tries to work, but as a result, 200 is OK as it should. It is possible to do with the help of else, so that when the answer is 200, 404 is not given? Thank!
ErrorDocument 404 /index.php?a=404and what do you think why this rule? - ArchDemon...?> <?php header('HTTP/1.0 404 Not Found'); ?>...?> <?php header('HTTP/1.0 404 Not Found'); ?>now 404 is given to the server. But if there is a page, an error message appears - the header has already been transmitted ie 404 tries to work, but as a result, 200 is OK as it should. It is possible to do with the help of else, so that when the answer is 200, 404 is not given? Thank! - MicroRu