1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

GoodForNothing Four Oh! Four 1.1.2 Beta 1

Custom 404 page for your XenForo site, now with a logging mechanism...

  1. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    Mr. Goodie2Shoes submitted a new resource:

    Four-oh!-Four by xenCODE (version 1.0.0) - Changes XenForo's default 404 page

    Read more about this resource...
     
  2. ArnyVee

    ArnyVee Well-Known Member

    Ah, very cool.

    I was going to start working on something like this as I wanted a custom page for my 404 error pages. :D

    I will be testing this out next week. Thanks for offering this add-on for the community (y)
     
    Mr. Goodie2Shoes likes this.
  3. Matthew2D

    Matthew2D Active Member

    This worked for a little while but then it just went back to the normal page.

    Any suggestions?
     
  4. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    I've set the add-on to be automatically disabled if debug mode is enabled...
     
  5. Matthew2D

    Matthew2D Active Member

    Here is a mario 404 page! :D

    1. Upload mario404.jpg to /styles/xenCODE/.

    2. In 4oh4.php search for:

    Code:
    background: url("styles/xenCODE/404.png") no-repeat scroll 0 0 transparent;
    
    Replace it with:
    background: url("styles/xenCODE/mario404.jpg") no-repeat scroll 0 0 transparent;

    Then your done! :)
     

    Attached Files:

    Brandon Sheley and ArnyVee like this.
  6. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    You've made a mistake or missed a point: ;)
    change
    Code:
    background: url("styles/xenCODE/404.png") no-repeat scroll 0 0 transparent;
    to
    Code:
    background: url("styles/xenCODE/mario404.jpg") no-repeat scroll 0 0 transparent;
    and the directory is 'xenCODE' NOT 'xenCode'...
     
  7. Matthew2D

    Matthew2D Active Member

    Thanks. I fixed it. ;)
     
  8. Van Damm

    Van Damm Member

    Unfortunately, your add-on does not make sense SEO-wise.
    Search engines will consider missing pages okay as your add-on returns 301 and then 200 HTTP codes. This will clutter search index of your website with lots of different links leading to 404 page that are considered valid by the search engine. This may lead to your website lowering in search results.
     
  9. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    Mr. Goodie2Shoes updated GoodForNothing Four Oh! Four with a new update entry:

    Fixed Bugs, Removed Redirection, Re-written the code.

    Read the rest of this update entry...
     
  10. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    Thank you for the feedback... I actually didn't thought that way :D
    anyways, the issue has been fixed. :)
     
    bogus likes this.
  11. Van Damm

    Van Damm Member

    Rendering the file is not the best way. You can store the template in the database and simply specify it in the response, i.e.:
    Code:
    return $this->responseView('GFNCoders_FourOhFour_ViewPublic_404', 'GFNCoders_404');
    
    You will also need to modify your ViewRenderer:
    Code:
    public function renderRaw()
    {
        $this->_response->setHttpResponseCode(404);
        $this->_response->setHeader('Content-Type', 'text/html; charset=UTF-8', true);
        return $this->createTemplateObject($this->_templateName, $this->_params);
    }
    
    Also using globals is considered a bad practice. And use HTML5 doctype please as XenForo itself uses it.

    P.S.: You can make use of XenForo's base url variable to use relative paths in the template:
    Code:
    <xen:if is="{$requestPaths.fullBasePath}">
        <base href="{$requestPaths.fullBasePath}" />
    </xen:if>
    
    and you don't have to duplicate default behavior in the controller. You can simply call parent method:
    Code:
    public function actionErrorNotFound()
    {
        if (XenForo_Application::debugMode())
        {
            return parent::actionErrorNotFound();
        }
        else
        {
            $this->_routeMatch->setResponseType('raw');
            return $this->responseView('GFNCoders_FourOhFour_ViewPublic_404', 'GFNCoders_404');
        }
    }
    
    if you correctly use XenForo's class proxy and extend your class from "XFCP_GFNCoders_FourOhFour_ControllerPublic_Error"

    I've tried all this and it worked.
     
    sinucello likes this.
  12. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

  13. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    okay added everything... and btw, you dont have to go so detailed... just
    would have sufficed :p
     
  14. ddmmh

    ddmmh Well-Known Member

    Nice add-on, definatley want to use this.

    I host my forums in a sub directory /community

    Is there a way I can make this universal across the entire site including directories not in /community? I just read your update, and according to that its bad for SEO to re-direct to a 404 page which is EXACTLY what I do in my .htaccess and I need to find a better solution, thanks
     
  15. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    Sorry, this add-on ONLY handles XenForo 404 Error.
    and redirecting to 404 page using .htaccess wont harm if you're using
    Code:
    ErrorDocument 404 ~file~
    because it automatically sets the '404 File Not Found' header ;)
     
  16. Van Damm

    Van Damm Member

    I just like clean and efficient code :)
     
    Mr. Goodie2Shoes likes this.
  17. phaze3131

    phaze3131 Active Member

    Is this compatible with 1.2?
     
  18. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    Mirovinger likes this.
  19. Lexy

    Lexy Active Member

    can you do similiar plugin to shows wallpapper with enter site letter/button

    [​IMG]
     
  20. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    @Lexy can you please elaborate like what exactly will be the purpose?
     

Share This Page