Custom vBSEO "404 Page Not Found" Page

Hoxxy

New Member
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.

Create a new template named custom_404 and paste the following content into it. (Feel free to customize, of course.)
HTML:
$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]"></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>

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:
<?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 ' [color=Red]/usr/home/username/public_html/forums/misc.php[/color] ';
?>
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:
[color=red]/usr/home/username/public_html/404.php[/color]
 
Great thanks! If you guys want to do this without your vbulletin template you can always add this:
Code:
ErrorDocument 404 http://www.example.com/404.php
to your .htaccess file. Personally I would use Hoxxy's method tho.
 
I am getting an error :

Warning: include( XXXX/misc.php ) [function.include]: failed to open stream: No such file or directory in XXXX/404.php on line 9

Warning: include( XXXX/misc.php ) [function.include]: failed to open stream: No such file or directory in XXXX/404.php on line 9

Warning: include() [function.include]: Failed opening ' XXXX/misc.php ' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in XXXX/404.php on line 9

Can any one help ???
 
change
Code:
include ' /usr/home/username/public_html/forums/misc.php ';
to
Code:
require_once('./misc.php');

and you should be fine.
 
Also change this line in the custom_404 template:

Code:
<title>Page Not Found - <phrase 1="$vboptions[bbtitle]"></title>

to this:

Code:
<title>Page Not Found - $vboptions[bbtitle]</title>

It looks better.
 
Warning: include(/home/***/public_html/forum/404.php ) [function.include]: failed to open stream: No such file or directory in /home/***/public_html/forum/vbseo.php on line 1446

Warning: include() [function.include]: Failed opening '/home/***/public_html/forum/404.php ' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/***/public_html/forum/vbseo.php on line 1446

This is what I have:
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 '/home/***/public_html/forum/misc.php';
?>
 
GCSkye said:
Warning: include(/home/***/public_html/forum/404.php ) [function.include]: failed to open stream: No such file or directory in /home/***/public_html/forum/vbseo.php on line 1446

Warning: include() [function.include]: Failed opening '/home/***/public_html/forum/404.php ' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/***/public_html/forum/vbseo.php on line 1446

This is what I have:
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 '/home/***/public_html/forum/misc.php';
?>
Do this: https://www.vbteam.info/vb-3-7-x-ad...-vbseo-404-page-not-found-page.html#post58950
 
Back
Top