Announcement

Collapse
No announcement yet.

Custom 404 Redirect?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom 404 Redirect?

    Unfortunately, "404" is too short a phrase to search on so I have to ask this question..

    Can I redirect vBulletin 404 errors to a custom page outside of vBulletin?

  • #2
    Try adding this in .htaccess file:

    Code:
    ErrorDocument 404 /path/to/custom/404.html
    I assume you installed vBulletin in a subdirectory in your site server root and you want to redirect to a 404 page that is in another subdirectory.

    GIPHY for vB5 AutoLinker Auto-Create Flag Report Topic Social Icons in Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts...and more!

    Comment


    • #3
      I tried that first and it doesn't seem as if it gets picked up. vBulletin still displays an internal 404 page.

      I'm guessing this is because of the rewrites in the existing vBulletin .htaccess file take pretty much anything after the base (/forums) and routes it through index.php?routestring=$1 where $1 represents, in my case, the page that doesn't exist. Once index.php realizes that it can't display what the user wants, vBulletin pushes out an internal page for the 404.

      I want to redirect to another page that's completely outside of vBulletin and lives at a different URL (on the same domain).

      Comment


      • #4
        You can also edit the error_404_description in the phrases to update the output.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud demonstration site.
        vBulletin 5 API - Full / Mobile
        Vote for your favorite feature requests and the bugs you want to see fixed.

        Comment


        • #5
          Any suggestions on a way to specify the URL of an entire page though? Any hooks anywhere, maybe, where I can at least throw a redirect header or javascript?

          Comment


          • #6
            Here's what I'm looking to redirect the 404 to... http://www.disaster.com/error404/

            Hopefully, you can see why this would be so much better than the standard "Your info wasn't found" vBulletin 404 page.

            So please, please, PLEASE.. any suggestions on code changes to support a 404 redirect would be GREATLY appreciated!

            Comment


            • #7
              You need to modify the error_page template.

              Code:
              <vb:if condition="isset($error['message']) AND $error['message'] == 'invalid_page_url'">
              
                  <script>
                       location.replace('/error404/');
                  </script>
              
              <vb:else />
              
                  original code for the template here
              
              </vb:if>
              Other solution is to copy and paste the entire HTML for your custom 404 page into the error_page template and overwriting the entire content. Just make sure all your links on that custom page pointing outside vB are absolute paths.
              Last edited by Glenn Vergara; Sat 16th Aug '14, 11:42pm.

              GIPHY for vB5 AutoLinker Auto-Create Flag Report Topic Social Icons in Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts...and more!

              Comment


              • #8
                That works perfectly (adding the if/then). I'd prefer to do it that way over modifying the whole template since I can just manage a single page on one system. Thank you!

                Comment


                • #9
                  BTW - probably a good spot for a hook if someone from VB is taking notes

                  Comment

                  Related Topics

                  Collapse

                  Working...
                  X