Error page 404 can't navigate correctly to relative link

I created a custom 404 page which generates fine. When I navigate away from the 404, the relative path gets appended to the url instead of being directed to the relative path. ‘website/news/’ -> 404 and when I click another link, the path becomes ‘website/news/about/’ instead of ‘website/about/’. My relative links all start with forward slashes so I don’t think that’s the problem. Please advise!

I also have ErrorDocument 404 /404.html in my .htaccess file

Add a / in front of links in your 404 page. “Relative” paths are relative to your current page. about/ is relative to the error page URL. /about/ is relative to the website root.

(where your website is something.com - an URL)

1 Like