Adding ErrorDocument rule to .htaccess file

Trying to set up a customized 404 Page Not Found to my site. Within RapidWeaver I see this message –– Notice: You must add an ErrorDocument rule to your .htaccess file.

Could anyone give me some insight into what must be added to the .htaccess file to allow me to have a custom 404 page?

An example is given:
ErrorDocument 404 /dev.healthcareconnects.ca/not_found/
<FilesMatch “.(bmp|cur|gif|ico|jpe?g|png|svgz?|webp)$”>
ErrorDocument 404 /resources/404.jpg

Dazed and confused…
Craig

Could you give us a URL to the error page?

If you called the page 404.html in the page inspector and left the folder name to be root / then the htaccess rule would look like this:

ErrorDocument 404 /404.html

If you used a folder name of then you need to add that to the path.

1 Like

Doug;

Thanks so much for your response. To confirm my understanding then:

  1. URL to the error page: dev.healthcareconnects.ca/not-found

  2. If you called the page 404.html: the Filename is actually index.php The Folder is: not-found

  3. So, would this be the correct .htaccess form then?: ErrorDocument 404/404.php/not-found

I haven’t tackled changes to the .htaccess file yet. I wanted to understand this part first.

Thanks in advance.
Craig

Actually, I think maybe this might be closer for the .htaccess file?

ErrorDocument 404 /dev.healthcareconnects.ca/not-found/

Cheers,
Craig

Okay,
The page you are showing is in a subdomain of dev is that a development (playground)?
For the error document directive to work it should to be a fully qualified URL (with protocol https: //) and filename (index.html or index.php). Or it can be a relative address (relative to the domain)


#Error 404
ErrorDocument 404 https://dev.healthcareconnects.ca/not-found/index.php
1 Like

That did it Doug. Thank you so much.

Cheers,
Craig

1 Like

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