I spent a long time googling for an answer to this, and never really found one. I talked to my friend Noel who showed me the way his team implemented a custom error page for their Sitecore site, and I’m documenting it here.
I wanted a single, shared error page that was editable inside of the Sitecore Content Editor that would show up for any 404 or 500 error page (or any error page).
First, create a rich text component for what you want to display on this error page.
I put this under a “Global Content” section, and copied the item path (which we’ll use later as a data source)
Then in the “Home” section of your site, add a page named “error”.
Edit it’s presentation details and add a rich text rendering (like the component you created earlier) and set it’s placeholder to ‘content’ and it’s data source to the path of your Rich Text Component.
Save and publish, and you should now have an /error page available on your site.
In the Sitecore configuration files, you’ll have to add or edit some settings.
/App_Config/Sitecore.config, there are several setting fields that will need to be changed.
<setting name="LayoutNotFoundUrl" value="/error" /> <setting name="LinkItemNotFoundUrl" value="/error" /> <setting name="ItemNotFoundUrl" value="/error" /> <setting name="NoAccessUrl" value="/error" /> <setting name="ErrorPage" value="/error" />
If you require specific error messages for each page, just change these fields to point to whatever page you want inside Sitecore.
It’s that simple! No code changes necessary (like most of the google results I found while trying to learn how to do this)