PhpLinkDirectory bogus categories fix, protect your directories from de indexing

Discussion in 'Directories' started by EvcRo, May 1, 2012.

  1. #1
    Hi

    problems with bad categories url's , 404 not returned on inexistent categories, duplicate pages indexed, seo url's for categories not working properly

    if you run phpld 2.x free version, google started to index bogus categories like yourdirectory/jkashjhsajda/ashajs/validacategory, displaying results from your /validcategory

    Thats why 1 submitted link can generate thousands of backlinks from bogus categories like

    /Sport/Industrialgoods
    etc

    anycombination of category1/category2/.../categoryn is displayed with duplicate results, even if those path should be 404, non existing categories.

    on any version 2 directory (all version 2 directories have this problem, checked many other people directories)

    directoryurl/business
    directoryurl/insertanygibberish/othergibberish/whatever/.../business - is identical with directoryurl/business

    this create duplicate pages in google leading, in the end, to deindexing (sooner or later, after March 15 update)

    Fix:

    index.php, between lines 107 and 120, mine looks like this

        $tpl->assign('qu', rawurlencode (trim ($_REQUEST['q'])));
    }
    else
    {
            $mypath = request_uri();// adapted from get_category() function
            $mypath = substr($mypath, strlen(DOC_ROOT)+1);
            $id = get_category();
            if (strpos($mypath, '.php') == 0 && $id == 0 && strlen($mypath)!==0 ){
                header("Status: 404 Not Found", true, 404);
                die('Category does not exist.');
            }
        if (!$tpl->is_cached('main.tpl', $id))
       {
            $path = get_path($id);
    Code (markup):
    practically

    else
    {
            $id = get_category();
            }
    Code (markup):
    becomes

    else
    {
            $mypath = request_uri();// adapted from get_category() function
            $mypath = substr($mypath, strlen(DOC_ROOT)+1);
            $id = get_category();
            if (strpos($mypath, '.php') == 0 && $id == 0 && strlen($mypath)!==0 ){
                header("Status: 404 Not Found", true, 404);
                die('Category does not exist.');
            }
    Code (markup):
    It's not the most elegant solution but from what i have tested it works ok, returning 404 on those 1000's of duplicate bogus categories url's

    If you encounter problems post here, im not a php programmer so some things can work wrong.
     
    Last edited: May 1, 2012
    EvcRo, May 1, 2012 IP