• Roar

    (@rori)


    Hi!
    Where can I find the files I could customize to make my own 404 and forbidden pages?
    I searched for the answer to this, but was not smart enough, apparently, to find the right combo of words to unlock the door to knowledge.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You’ll need some .htaccess info:
    https://www.clockwatchers.com/htaccess_error.html
    Once you’ve got them working, you can wrap any layout around them.

    Thread Starter Roar

    (@rori)

    Sorry to ask a daft question, but the ones that show up now, are those just generic pages that are not actually pulled from anywhere in my files?

    Pretty much so, yes.
    They are set somewhere in the hosting system, but they are very easy to override.
    In my .htaccess (which covers my site, with wp being in a sub-dir) I have this:
    ErrorDocument 401 401.html
    ErrorDocument 403 403.html
    ErrorDocument 404 404.html
    Those files sit alongside my main index.html, and they look how I wanted them to.
    The syntax may be slightly different for some hosts – if your host has any support forums, just do a search for ‘custom 404’ and you should get some info.

    Is it possible to point the 404 error to a .php file? I’ve attempted it and i get this error:

    Fatal error: Call to undefined function: get_header() in /data/sites/36626/macographie.com/www/wordpress/wp-content/themes/macographics/404.php on line 1

    I think I understand why I’m getting the error, I just don’t know how to fix it.

    ok, i just want to post this for anyone who happens to look for this. i guess i didn’t look too hard through the documentation, so it could be there. it seems like something people might want to do. maybe it’s obvious to people more familiar with php. i guess i did eventually figure it out, but it woulda been nice to figure it out earlier. anyway:

    create an .htaccess file and add the following line to utilize the 404.php file in your theme as the error page that shows up:

    ErrorDocument 404 /wordpress/index.php?p=404.php

    the reply above mentions 3 pages, just open 404.php and ‘save as…’ 401.php and 402.php then edit them if you want different messages for the different errors.

    Could you provide more detail on how to make an .htaccess file (for example is that an extension I can save a file as? – so instead of “monkey.html” I might have “monkey.htaccess”?)

    Also that line you have:

    ErrorDocument 404 /wordpress/index.php?p=404.php

    Should that between any kind of tags?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Customize 404 and Forbidden Pages? – Rori’ is closed to new replies.