Page "Error 404"


(Massimo) #1

Hi,
the page 404.html must be located on the root or the path is indifferent?

Thanks.
Massimo


(scott williams) #2

normally it’s in the root but you could put it anywhere and point to it in the .htaccess 404 rule


(Dick Sijtsma) #3

Don’t forget to put the following code into the ‘head’ section of the page inspector:

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

That way, the 404 page gives the correct 404 http response. If you don’t add it, your custom 404 page gives a 200 code: page found.

200 OK : The request has succeeded.


(Massimo) #4

I followed this procedure indicated by Doobox. So the real page 404 is full empty and then redirect users to another RW page with website style.

Seems to works fine.
My site is https://www.iografico.it and if you type a bad link like https://www.iografico.it/asdasd the redirected page is displayed.

Is this a good practice?


(Dick Sijtsma) #5

Almost done! The redirection is OK. However, the page it was redirected to does exist. And that page gives a 200 code. It should give a 404 code. You can achieve that by putting the above mentioned code into the header:

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

With that code, the page gives the correct 404 code, instead of the 200 code.


(Dick Sijtsma) #6

Check your http header here:

http://www.webconfs.com/http-header-check.php


(Massimo) #7

Hi Dick,
thanks for the suggestion, I added the code (see the screenshot) but the page still seems to return the code 200.
Did I do something wrong?


(Dick Sijtsma) #8

Did you change the extension of the page to .php instead of .html?
And did you remove the .html file from the server, afterwards?


(Massimo) #9

The file was already a .php file --> see screenshot


(Dick Sijtsma) #10

Strange. I’m doing exactly the same, and it all works. Check this url in de header check. You see a 404 returned:

https://www.simplon31.nl/404/

2018-04-03_10-47-42


(system) #11

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.