Support » Plugin: Simply Static » How to Include HTML File for 404 Page

  • Resolved David

    (@judofire)


    Hello,

    Is there any way to have Simply Static include an HTML file for the 404 page generated by my theme? From my understanding of how this plugin works, it follows all links recursively to find as many pages as possible, starting at the root domain. This, of course, doesn’t capture the 404 page since it’s never explicitly linked any on any pages.

    I tried adding a non-functional URL to the “Additional URLs” setting to see if I could force the plugin to include the page, but the export log shows it failed with HTML status code 404 (not surprising in retrospect, lol).

    So, is there any way to include the 404 HTML file in the export?

    Thanks,
    -David

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author patrickposner

    (@patrickposner)

    Hey @judofire,

    that’s a bit problematic as the file would not be used without further modifications on your server.

    You can create a 404 page yourself with custom text, generate a static version of it (add it to additional URLs), but you still need a way to route non-existent pages to that page.

    Most of the static hosting providers already have a solution for that (like Netlify, Vercel..), otherwise, you need a .htaccess file with a rule to handle that for you.

    Best regards,
    Patrick

    Thread Starter David

    (@judofire)

    Hi Patrick,

    Thanks for following up. I use Netlify, and their instructions for using a custom 404 page look pretty simple. I’m less concerned with how to get my static website to serve the 404 page and more concerned with how to generate a static copy of it.

    Since I couldn’t figure out how to force this plugin to include the 404 page in the export, I attempted to manually generate a static copy. I ran my local installation of WordPress, saved the HTML file from my browser, and used a text editor to tweak the links, but the result was unsatisfactory. The resulting HTML file leaked my admin username (probably because I was signed in when I saved the file), images weren’t loading, and some of the CSS formatting wasn’t applied. I’m sure I could have fixed all the obvious issues with enough diligence, but I became concerned that I could easily overlook a major issue that is only visible in the HTML code.

    This plugin has worked really well for generating static copies of all my other pages, and so I’d ideally like to use it for the 404 page as well. Is there any way to include the 404 page in the export?

    Thanks again!
    -David

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.