General / How To

Styles not loading for 404 pages

If you're managing a 404 page in the CMS and find that it doesn't display properly on your live site in certain scenarios, the issue is likely due to how CSS file(s) in the page are being referenced. To fix this, we'll want to change the link rewriting for the asset at the page level. 

By default, links within Page assets in the CMS will be relative. With 404 pages specifically, this can cause behavior where browsing to a non-existent page on the live website at certain depths in the directory structure will cause relative links to CSS files for the 404 page to point to invalid resources.

To address that behavior, the following steps should be taken:

  • Edit the 404 Page in your CMS (note: this Page may not actually be named 404, but that is the most common practice)
  • Click the Configure tab
  • Check the box to Override the current Site's asset link rewriting behavior for this asset

At this point, you'll see different link rewriting options appear that you can set explicitly just for this Page.

  • Select Absolute
  • Click to Submit the Page
  • Publish the 404 Page

Now, the CSS resources for the Page should load regardless of the location from which the 404 page is requested.