Sinisterly
[Tutorial] How to Create a Custom 404 Page for your MyBB Site - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Design (https://sinister.li/Forum-Design)
+--- Forum: Web Design (https://sinister.li/Forum-Web-Design)
+--- Thread: [Tutorial] How to Create a Custom 404 Page for your MyBB Site (/Thread-Tutorial-How-to-Create-a-Custom-404-Page-for-your-MyBB-Site)



[Tutorial] How to Create a Custom 404 Page for your MyBB Site - Ocean - 11-11-2012

Okay, I recently did this for my site, Lounge Boards, and I thought that I should tell you guys how to do it too step by step.


1. Add this code to the last line on your .htaccess
Spoiler:
Code:
ErrorDocument 404 /filenotfound.php



2.Create a file called filenotfound.php, and add this to it:
Spoiler:
Code:
<?php define('IN_MYBB', 1); require_once("global.php"); add_breadcrumb("404 Error", $_SERVER['PHP_SELF']); eval("\$page = \"".$templates->get("404")."\";"); output_page($page); ?>



3. Upload the filenotfound.php file to your main website's directory.

4. Create a new template on your main theme with the name 404 and add this to it:
Spoiler:
Code:
<html> <head> <title>Your title</title> {$headerinclude} </head> <body> {$header} Your 404 Page Content {$footer} </body> </html>



5. Edit where it says Your 404 Page Content to whatever suits your needs. Smile


That's it! You're done. Any page that gives you a 404 error will now show what you've put in your template.


RE: [Tutorial] How to Create a Custom 404 Page for your MyBB Site - Blur - 11-11-2012

Thanks for this nicely written tutorial, Ocean!


RE: [Tutorial] How to Create a Custom 404 Page for your MyBB Site - CRATE - 11-11-2012

Cool tutorial ocean thank you!


RE: [Tutorial] How to Create a Custom 404 Page for your MyBB Site - Banadmin - 11-11-2012

Thanks for the tutorial, Ocean! This will come in useful, I hate those default HostGator 404 error pages.


RE: [Tutorial] How to Create a Custom 404 Page for your MyBB Site - Ocean - 11-11-2012

(11-11-2012, 04:44 AM)Uzi Wrote: Thanks for the tutorial, Ocean! This will come in useful, I hate those default HostGator 404 error pages.

I know. Luckily, I don't use Host Gator anyways, but I was tired of the default Lightspeed 404 error.


RE: [Tutorial] How to Create a Custom 404 Page for your MyBB Site - au3 - 11-11-2012

Nice tutorial Ocean!