Setting Up a 404 Page in Elements

@dan I have been trying to get a 404 error page set up for one of my websites. I have created the page, which works fine. But when an error occurs not all of the content of the page is displayed.

The menubar is present as is the full footer, but my banner image is missing. Plus some of the content is malformed. For instance, the H1 header is drawn small and none of the spacing on the container is being applied.

All the links and the buttons I added to the page work fine, but something is not right.

What am I doing wrong?

I have added the pointer to the page to the .htaccess file.

If you want to check out the 404 error page you can do it on the live site - https://mairfoils.com/. The actual page is Page Not Found for MAIRFOILS.

I might have had the same problem sort of…my server allows me to create a password protected page which works a treat…I wanted an error page, that worked but left a load of gibberish as well on the page…when the customer help chap on my server noticed when it went to the page it had a slash / at the end of the page…when he erased it on the page and refreshed it went to the page as I had it set. I know jack about code etc but all elements created pages have a / at the end when published so I wouldnt know how to cure that.

1 Like

@handshaper, have just checked your site and it appears to be working, did you already change something or fix it yourself?

@dan No I have not changed or managed to fix the problem. The page works fine if you navigate to it. But when you get to it from a real error it is incomplete.

Try to add in the head of the 404 page :

<?php header("HTTP/1.1 404 Not Found"); ?>
<base href="here-the-url-of-your-404-page"> ?

Awesome, thank you, that fixed the problem.

Although I did have to remove the “?” at the end of the code otherwise it would be displayed at the top of the page.

1 Like