Fork me on GitHub

Suggestion - 404's  Bottom

  • Hi,
    Apologies if this has already been incorporated in .8x, or mentioned elsewhere but my quick search didn't reveal much...

    Since moving my site I've become much more aware of search engines. Anyway, the core modules don't return 404's for pages that are removed, they just return a normal page with some error text saying the item couldn't be found. Not much god for bots.

    An easy fix which I've implemented for my site across core/custom modules I've written is a pn404 function. This ensures a consistent error page is generated across modules with the all important 404 header. Search engines will now remove the old pages from their index.

    The function I wrote allows the module to specify the type of item missing, e.g. download, web link, article etc. And to provide some additional useful links, e.g. download main page, download module search etc. I'm sure you guys can do much better (if you haven't already!)

    Cheers!
  • I agree. When content is nolonger used, as in deleted, or a user doesn't have the rights to access a part of a module. There aren't any httpheaders send. Far as I seen only the admin.php handles the httpheaders correctly.
    .
    In other modules you just see lines like:

    Code

    if (!pnSecAuthAction(0, 'Members_List::', '::', ACCESS_READ)) {
            return pnVarPrepHTMLDisplay(_MODULENOAUTH);
        }
        if (!pnSecAuthAction(0, 'Downloads::Add', '::', ACCESS_ADD))
        {
            return errorpage(__file__,__line__,_DL_MODULENOAUTH );
        }
        if (!pnSecAuthAction(0, 'Topics::', '::', ACCESS_OVERVIEW)) {
            echo _TOPICSNOAUTH;
            include 'footer.php';
            return;
        }
        if (!defined('LOADED_AS_MODULE')) {
        die ("You can't access this file directly...");
        }

    .
    No authorization should always give a 403, and on module $mod not available should always give a 404.
    .
    There should be an error module that handles these issues and send the correct http-headers along with the error.
    .
    Same goes for the 'problem with connection to the database'-error, and the 'site has been turned off'-error should be a 5xx header send.
    .
    Search engines seems to update and doing the indy 500 on my site in the first week of a month, and somehow my mysql seems to be having a vacation, which means all pages will be reindexed stating an error.
    .
    In .8 there's an Errors-system, but since i don't want to spend much time on the ms2 release, i haven't checked it out totally yet. But I hope this system will deal with all errors on module handling when content isn't there and/or there's an access denied.
    .
    Hope .8 will be bugless and stable soon, there are many things in .7 that could be so much better.
  • Quote

    No authorization should always give a 403, and on module $mod not available should always give a 404.

    A lot of changes have gone into 0.8 lately to accomplish such things. This has been integrated into the new Status/Error message framework and should work well. The implementation for module authors is IMHO about as easy as it can get.

    Quote

    Same goes for the 'problem with connection to the database'-error, and the 'site has been turned off'-error should be a 5xx header send.

    Don't think that has been done yet, but it's a good suggestion. Chances are Mark will pick this one up when he sees this thread.

    Quote

    Hope .8 will be bugless and stable soon, there are many things in .7 that could be so much better.

    I agree on .7 not being optimal. I am 100% convinced that 0.8 will be better, faster, more flexible. It won't be bugless (no software ever is) but it should be significantly better than .7.

    Greetings
    R
  • Ah okay that's good to hear.
    I hadn't considered the DB error. Good idea!

    .8x sounds like it should be fantastic, but it's going to be a lot of work to setup since I now have over 100 modifications to the core of .76x to make things run how I want. It'll be fun working out which modifications I'll need to make and which you guys and have implemented!

    (Off topic: but will we be able to run legacy modules such as the old download module? I made an API compliant, templated user interface for the old module to simplify the layout and improve the functionality (file type icons etc etc). I'll either have to write the admin half to have a complete module, or tie it into the new module. I'm not looking forward to either!)
  • All,

    I've updated SVN to send a 503 Service Unavailable response when the site off feature is enabled. The new error generated code allows a module developer to use something like the following - in this case there will not only be an error triggered but a 403 response code will be sent too.

    Code

    return LogUtil::registerError(_MODULENOAUTH, 403);


    -Mark

    --
    Visit My homepage and Zikula themes.
  • I edited the templates of the default error messages in .7.x, and add the 503's myself:

    Code

    <?php
    header("HTTP/1.1 503 Service Unavailable");
    ?>
    // rest of the HTML

    Then I turned off MySQL, and looked at the headers that were send. Which returns:

    Quote

    HTTP/1.x 503 OK
    I'm wondering if that'll be enough. Because 404's return a '404 Not Found' and not a '404 ok'.
    .
    Is this little edit I made enough to avoid SE's from re-indexing the error, instead of returning another time ?

This list is based on users active over the last 60 minutes.