vBulletin 4, the most powerful community software + vBSEO 3.5, the ultimate SEO solution = Your ultimate platform for 2010 and beyond. Click below to learn more.

Page 1 of 17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 ... LastLast
Results 1 to 15 of 250

Create a Custom vBulletin "404 Page Not Found" Page, and direct vBSEO to use it.

This is a discussion on Create a Custom vBulletin "404 Page Not Found" Page, and direct vBSEO to use it. within the Member Articles forums, part of the Focus on Members category; This will allow you to create a custom 404 Page Not Found page that uses your vBulletin templates, and includes ...

  1. #1
    Senior Member
    Real Name
    Keith Cohen
    Join Date
    Jul 2005
    Location
    Raleigh, NC USA
    Posts
    6,147

    Create a Custom vBulletin "404 Page Not Found" Page, and direct vBSEO to use it.

    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.)

    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>
    
    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 '/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.)
    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 -->
     <title>Page Not Found - {vb:raw vboptions.bbtitle}</title>
     {vb:raw headinclude}
    </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, 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 '/usr/home/username/public_html/forums/misc.php';
    ?>
    
    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:
    /usr/home/username/public_html/404.php 
    Last edited by Ceri May; 12-16-2009 at 09:09 PM.

  2. #2
    Senior Member Snake's Avatar
    Real Name
    Josh
    Join Date
    Oct 2005
    Location
    Cleveland, OH
    Posts
    413
    Wow! This is really SOMETHING! Thanks for the article, Keith. I appreciate it.
    Metal Gear Forums - Discussion on the popular series of console stealth-based games.

    My Mods: Coming Soon | My Tutorials: Coming Soon

  3. #3
    Member
    Real Name
    Derek
    Join Date
    Sep 2006
    Location
    Spokane, WA
    Posts
    76
    Awesome I'll set this up in a bit!!! :yay
    Owner / Webmaster
    House of Crazed
    http://www.houseofcrazed.com

  4. #4
    Senior Member
    Real Name
    Dhillon
    Join Date
    Apr 2006
    Posts
    327
    this is very neat,thanks much

  5. #5
    Senior Member dutchbb's Avatar
    Real Name
    ---
    Join Date
    Oct 2005
    Location
    Belgium
    Posts
    786
    Nice, I was thinking about it but not sure if it would be a good idea, with the search option included its actually better than redirecting to the homepage.

  6. #6
    Member
    Real Name
    Derek
    Join Date
    Sep 2006
    Location
    Spokane, WA
    Posts
    76
    Awesome works great I'm curious is there a way I could include this onto pages that are not re-written with VBSEO ?
    Owner / Webmaster
    House of Crazed
    http://www.houseofcrazed.com

  7. #7
    Senior Member
    Real Name
    Keith Cohen
    Join Date
    Jul 2005
    Location
    Raleigh, NC USA
    Posts
    6,147
    You can use a .htaccess file to point to a custom 404 page, or some hosts have an online interface to let you specify a custom 404 page. Just point them to that same 404.php file you created.

  8. #8
    Senior Member dutchbb's Avatar
    Real Name
    ---
    Join Date
    Oct 2005
    Location
    Belgium
    Posts
    786
    Changed it a bit for different layout: http://forum.dutchbodybuilding.com/404

    If you want it here's the code for in the template:

    PHP 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>Error 404Page Not Found - <phrase 1="$vboptions[bbtitle]">$vbphrase[x_powered_by_vbulletin]</phrase></title>
    </
    head>
    <
    body>
    $header
    $navbar
    <div style="text align:center;">
    <
    div style="margin:auto;text-align:left;padding:20px 30px 20px 30px;width:750px;border:1px solid #333;">
    <
    h2 style="font:normal 26px Verdana,sans-serif;">Error 404Page Not Found</h2>
    <
    p>Unfortunatelywe couldnt find the page you tried to view.</p>
    <
    p>It is possible that the link you followed to get here was invalid, or out of date.</p>
    <
    h3 style="font:20px Verdana,sans-serif;">Alternative Pages</h3>
    <
    p>Please use the Search facility (aboveto find the page you were looking for. Alternativelyyou can go to one of the following popular pages:</p>
    <
    ul>
    <
    li><a rel="nofollow" href="/search.php">Advanced Forums Search</a></li>
    <
    li><a href="/">Forums Home Page</a></li>
    </
    ul>
    </
    div>
    </
    div>
    $footer
    </body>
    </
    html

  9. #9
    Senior Member BamaStangGuy's Avatar
    Real Name
    Brent Wilson
    Join Date
    Aug 2005
    Location
    Huntsville, Alabama
    Posts
    2,447
    Why is it not seeing my CSS? http://www.mustangevolution.com/foru...eadlights.html

    NM I just copied and pasted it into the template.

    Is there a problem reading it when the style is stored in the file system?

  10. #10
    Senior Member
    Real Name
    Keith Cohen
    Join Date
    Jul 2005
    Location
    Raleigh, NC USA
    Posts
    6,147
    Ok, Oleg to the rescue!

    You need to add this line to the 404.php file to correct the issue. (First post updated.)

    This is the line that was added:
    Code:
    define('VBSEO_PREPROCESSED', 1);
    

  11. #11
    Senior Member Snake's Avatar
    Real Name
    Josh
    Join Date
    Oct 2005
    Location
    Cleveland, OH
    Posts
    413
    Hehe. I'm not sure whether you'll like mine but here you go. Check it out.

    Final Fantasy Forums - HTTP Error 404: File Not Found

    If you guys like it, then I'd be happy to share it with you all. Also I have even created from 400 till 505 custom error pages which took me a while to do that.
    Metal Gear Forums - Discussion on the popular series of console stealth-based games.

    My Mods: Coming Soon | My Tutorials: Coming Soon

  12. #12
    Member
    Real Name
    Derek
    Join Date
    Sep 2006
    Location
    Spokane, WA
    Posts
    76
    Quote Originally Posted by Keith Cohen View Post
    You can use a .htaccess file to point to a custom 404 page, or some hosts have an online interface to let you specify a custom 404 page. Just point them to that same 404.php file you created.
    Been trying to use

    ErrorDocument 404 /forums/404.php

    but the stupid thing just won't work ... *cries*
    Owner / Webmaster
    House of Crazed
    http://www.houseofcrazed.com

  13. #13
    Junior Member
    Real Name
    abdulla
    Join Date
    Feb 2007
    Posts
    1
    DarkBlade, can you please share your custom error pages? they really look good

  14. #14
    Senior Member
    Real Name
    Michael
    Join Date
    Oct 2005
    Posts
    1,737
    Blog Entries
    1
    Thanks Keith! and Thanks Tijl for the modified template. Been wanting something custom for this for quite some time now and had no clue how to do it.

  15. #15
    Member
    Real Name
    Joe
    Join Date
    Oct 2005
    Posts
    30
    Thanks Keith, nice custom feature!

LinkBacks (?)


Tags for this Thread