Похожие чаты

I want to make a custom error page if the

browser received 404 sent by web server and php script
My project struct looks like following:

test is an empty folder
.htaccess
.index.php
.send.php
. 404.html
/test
In the file htaccess
ErrorDocument 404.html
..
send.php

<?php
http_response_code(404);
die();


I tried to use header function

<?php
header("HTTP/1.0 404 Not Found");
die()

?>
Both worked for returning request but the web server didn't redirect to the custom error page..

When I accessed http://example.com/test, 404 was returned by web server not my php script, it worked fine that successfully redirected my custom error page..
What's wrong with my php code?
T

2 ответов

7 просмотров

Please format the code you posted, by wrapping it in triple backticks. -> `

You are not testing it right... First there are error 404 originated on apache/nginx triggered whenever a file is not found on the filesystem, these could be catched with apache configuration. And there are errors 404 or whatever number you like, triggered with PHP header function, but the logic here is completely on your own,...

Похожие вопросы

Обсуждают сегодня

For managing user-generated content rights in gaming? 🤯🚀
Brian
37
Do we have a Chinese community here?
迪迦
20
@Aiwan что такое база образца?
Alexey
27
Не многие знают, а кто знает, тот уже успел забыть, что в далёком 2004 году эта игра произвела настоящий фурор, настолько революционной была технология, применяемая для её соз...
ICCID
4
Why binance delisting the token?
🅰🅽🅳🆁🅴🆆
14
Hi is Atomic wallet safe to exchange btc to xmr?
Regex
20
Короче я тут узнал полный пиздец Что кучу постов которые я создавал через posted Спустя время не могу редактировать и менять Мол телега возвращае ошибку Это реально так ...
inc.
13
коллеги, добрый вечер! А никто не знает как модальная форма может себя закрыть? Ну допустим модальная форма определила, что смысла ей работать нет и хочет вернуть modalResult...
Михаил
83
Hello, Ergo Investor here. Had a few questions for the leadership of the project, from what I’ve seen @kushti_ru , @Armeanio @dadreboi In one sentence, what is your vision f...
A
13
Is UniBright Freequity an active live product ? A friend here in Asia was discussing the Tokenisation of RWA’s in his case Real Estate as he’s a developer with numerous overs...
Digital Trust
5
Карта сайта