Support » Fixing WordPress » 301 redirect and 404 errors

  • Have migrated to WP but have massive amounts of 404 errors (34,000 to be exact).
    Google Webmaster indicates the errors but when clicked they redirect correctly
    Have redirected using following code. Any obvious mistakes ?:
    in htaccess:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(es|en|de)/.+-([0-9]+)\.html$ ?antiguoID=$2&antiguoLANG=$1 [L]

    en php (/wp-content/themes/citygonow/header.php):

    if(isset($_GET['antiguoID']) && isset($_GET['antiguoLANG'])){
        $match=$wpdb->get_results('select det.post_id from cgn_detalles det where oldid='.$antID);
                $newID=icl_object_id($newID, get_post_type($newID, false, $antLANG));
            header("Location: ".$npguid, true, 301);
            header("HTTP/1.0 410 Gone");
            header("Status: 410");
            echo "removed content";

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

  • The topic ‘301 redirect and 404 errors’ is closed to new replies.