Custom 404 Page

I have made a custom 404 page at

I have edited my .htaccess file to send broken links to this page using the code widget here:

It all works great - except, I don’t know how to set the HTML status code of my 404 page correctly. It currently returns a 200 status code.

I have tried both:


header(“HTTP/1.0 404 Not Found”);



header($_SERVER[“SERVER_PROTOCOL”]." 404 Not Found");

In the 404 page header code, but still getting the 200 code returned. What am I doing wrong?

1 Like

Best to add this to your htaccess file after you created the page

ErrorDocument 404 /yourpagename.html

1 Like

Thanks bourne

.htaccess already has that code on it, it works in that it redirects broken links to my 404 page - but I still get a 200 HTTP status and all the SEO scanning sites tell me that I don’t have a custom 404 page

Web design does my nut in

1 Like

Ah got it

I have substituted

ErrorDocument 404


ErrorDocument 404 /404/

And it works perfectly - EDIT: thank you @bourne!

1 Like

I always thought it had to be .shtml for the 404 page if you are using cPanel. That isn’t an option in Blocs, so I am glad to hear this works, assuming you are using cPanel.

No - I’m editing the .htaccess file directly. It isn’t written by Blocs so can be coded in a text editor separately

Sure I’ve done that in the past but had difficulty getting it to work reliably using php error pages. Perhaps it was just the server, but I even had the web host try without luck, whereas pages set as shtml just worked and didn’t require any htaccess code.

I use both to be sure.

A really cool looking 404 mate. look at this one I find it to be pretty funny, I get the hidden message behind it.

1 Like

Just one note. If you are exporting page from blocs and you have called it 401, 40… page. Don’t forget to exclude them from site map :smiley:


No way to exclude the 404 page from the Blocs generated site map unless I edit it manually?

Yes. You need to do it manually. Before upload it to host
But when you export it once you can delete them from your project. Because normally the extensions is .shtml so you will not override ti next time when you upload your exported project to host.

Thank you. I have edited it manually and turned off auto sitemap so it won’t get overwritten

But my sitemap is sitemap.xml not .shtml?

error pages have the extensions .shtml :smiley: not sitemap :smiley:

I tried following the example above, but when I use:

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^liverupucams
RewriteRule (.
) [R=301,L] RewriteRule ^/?(.*).(html) /1 [R=301,L] RewriteCond %{REQUEST_FILENAME} ~-f RewriteCond ^(.*[^/]) /$1/ [L,R=301]
ErrorDocument 404 /404/

when you go to it should redirect to the 404 error page and it just gives me a standard error:

Not Found
The requested URL was not found on this server.

Apache/2.4.29 (Ubuntu) Server at Port 443

Can someone help me with this?

This question is old, but … If this error occurs, you should test:

ErrorDocument 404 /404/index.html

With html files, the full path must be specified. With php files, the folder is enough

1 Like

Yes, I have done that in the past, however I had trouble making it work consistently with php error pages. I even had the web host test without success, so maybe it was just the server, but htaccess redirect generator html pages just performed and didn’t need any htaccess javascript.