Support » Plugin: Yoast SEO » [Plugin: WordPress SEO by Yoast] 404 errors in canonical url for some search pages

  • WordPress version: 3.4.1
    WordPress SEO version: 1.2.5

    I did this: i installed WP SEO 1.2.5, imported data from All in One SEO, desactivated AiO SEO and activated WP SEO 1.2.5

    I expected the plugin to do this: put the right canonical url in all pages

    Instead it did this: for some search result pages, the canonical url go to a 404 page.
    For exemple, this page has the canonical url : that give a 404 page.
    It seems to be a problem with :
    %2B and + in canonical urls

    But it is strange because it seems to append only for some search pages and not for all…
    This page
    Has a good canonical :

    GWT alert me that it found a lot of 404 erros (more than 30) and all are coming from a bad canonical since i’ve installed the plugin.

    What can i do please ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Some additional informations :
    The link rel=”next” and link rel=”prev” have the same problem.
    %2B is not transformed in +

    For now, i’ve just put a temporary solution by adding :
    $canonical = preg_replace( '/\%2B/', '+', $canonical );
    in the function “function canonical”


    $url = preg_replace( '/\%2B/', '+', $url );
    in the function “adjacent_rel_links()”

    But… Is this a good solution ? And why does this problem happend ?


    I am also getting this error. any solutions Yoast?

    Were you able to get any better solution?


    This is what i have done now to fix the errors.

    The following line

    echo '<link rel="canonical" href="' . esc_url( $canonical, null, 'other' ) . '" />' . "\n";

    is converted to

    echo '<link rel="canonical" href="' . esc_url( urldecode($canonical), null, 'other' ) . '" />' . "\n";

    And I have added

    $url = urldecode($url);

    to the next line of

    $url = $this->canonical( false, true );

    I am not sure it is a right solution as it touches the core of plugin. Anyway, it works for site.

    I am just updating this thread.

    The file i modified is at /wp-content/plugins/wordpress-seo/frontend/

    The filename is class-frontend.php

    Thank you,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] 404 errors in canonical url for some search pages’ is closed to new replies.