This will allow you to create a custom 404 Page Not Found page that uses your vBulletin templates, and includes your vBulletin header, navbar, and footer.
All without modifying any vBulletin files.
vBulletin 3.x Custom 404
Create a new template named custom_404 and paste the following content into it. (Feel free to customize, of course.)
Then, create a file called 404.php in your site root, or forums root, and paste the following content into it. You will need to customize the code in red to point to the physical location of the misc.php file that comes with vBulletin.Code:$stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> <!-- no cache headers --> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" /> <meta http-equiv="Cache-Control" content="no-cache" /> <!-- end no cache headers --> $headinclude <title>Page Not Found - <phrase 1="$vboptions[bbtitle]">$vbphrase[x_powered_by_vbulletin]</phrase></title> </head> <body> $header $navbar <br /> <div style="padding-left: 25px; padding-right: 25px; font-weight: bold;" align="center"> Sorry, the page you have requested cannot be found. <br/><br/> You can try a <a href="$vboptions[bburl]/search.php">search</a> if you are looking for something specific. </div> $footer </body> </html>
Code:<?php header("HTTP/1.0 404 Not Found"); header("Status: 404 Not Found"); $_GET['do']='page'; $_REQUEST['do']='page'; $_GET['template']='404'; $_REQUEST['template']='404'; define('VBSEO_PREPROCESSED', 1); include '/usr/home/username/public_html/forums/misc.php'; ?>
vBulletin 4.x Custom 404
Create a new template named custom_404 and paste the following content into it. (Feel free to customize, of course.)
Then, create a file called 404.php in your site root, or forums root, and paste the following content into it. You will need to customize the code in red to point to the physical location of the misc.php file that comes with vBulletin.Code:{vb:stylevar htmldoctype} <html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html"> <head> <!-- no cache headers --> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" /> <meta http-equiv="Cache-Control" content="no-cache" /> <!-- end no cache headers --> {vb:raw headinclude} <title>Page Not Found - {vb:raw vboptions.bbtitle}</title> {vb:raw headinclude_bottom} </head> <body> {vb:raw header} {vb:raw navbar} <br /> <div style="padding-left: 25px; padding-right: 25px; font-weight: bold;" align="center"> Sorry, the page you have requested cannot be found. <br/><br/> You can try a <a href="{vb:raw vboptions.bburl}/search.php">search</a> if you are looking for something specific. </div> {vb:raw footer} </body> </html>
Then, in your vBSEO Control Panel, for the "File Not Found" requests handling? setting, enter the following. Again, you will need to customize this to point to the actual physical location of the 404.php file that you created in the previous step.Code:<?php header("HTTP/1.0 404 Not Found"); header("Status: 404 Not Found"); $_GET['do']='page'; $_REQUEST['do']='page'; $_GET['template']='404'; $_REQUEST['template']='404'; define('VBSEO_PREPROCESSED', 1); include '/usr/home/username/public_html/forums/misc.php'; ?>
Code:/usr/home/username/public_html/404.php


9Likes
LinkBack URL
About LinkBacks





Reply With Quote




