• Resolved casacochecurro

    (@casacochecurro)


    Hi, I’ve build url slugs which has character ‘+’

    In canonical the url is different, in every ‘+’ change it for ‘%20’

    This generate duplicate urls problems.

    How can I set the canonical url equal as normal url (with ‘+’)?

    I actually use this filter:

    add_filter('wpseo_canonical','canonical_gasolineras');
    add_filter('wpseo_opengraph_url','canonical_gasolineras');
    function canonical_gasolineras($canonical){
        global $post;
    
        if ( is_page('gasolineras-mas-baratas') && (!empty($_GET['localidad']) ) ) {
            $localidad_seleccionada = !empty($_GET['localidad'])?$_GET['localidad']:'';
            
            $canonical = 'https://www.casacochecurro.com/gasolineras-mas-baratas?localidad=' . $localidad_seleccionada;
        }
        return $canonical;
        
    }

    I’ve tried in line:

    $canonical = 'https://www.casacochecurro.com/gasolineras-mas-baratas?localidad=' . $localidad_seleccionada;

    This:

    $canonical = 'https://www.casacochecurro.com/gasolineras-mas-baratas?localidad=' . str_replace(' ','+',$localidad_seleccionada);

    and this

    $canonical = 'https://www.casacochecurro.com/gasolineras-mas-baratas?localidad=' . urlencode($localidad_seleccionada);

    But not resolved. How can I set the canonical url equal as normal url (with ‘+’)?

    Thanks

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello Casacochecurro,

    Thanks for reaching out regarding your canonical URL.

    We understand that the character ‘+’ is being changed to ‘%20’ in your canonical URL. Special characters in URLs can be encoded. It is common to encode characters that may cause issues in URLs; spaces being a common example (%20). See ASCII tables.

    We do not think this is a Yoast SEO issue. However, can you please deactivate the plugin and see if the issue persists?

    Thread Starter casacochecurro

    (@casacochecurro)

    Hi Maybellyne

    After I deactivated it (Yoast Seo + Premium Plugin), the canonical is not generated by Yoast, isn’t it? I don’t understand your logic.

    The new url canonical I think It is created by ‘SiteKit by Google’ and, in this case, the canononical didn’t add the parameter/value:

    <link rel="canonical" href="https://www.casacochecurro.com/gasolineras-mas-baratas" />
    <meta name="generator" content="Site Kit by Google 1.48.1" /><style type="text/css">div#toc_container ul li {font-size: 109%;}</style>
    Plugin Support Maybellyne

    (@maybellyne)

    Thanks for the feedback.

    Since your site also has the Yoast SEO Premium installed and an active subscription, please contact our support team for assistance. How can I get premium support?. This will allow us to take a closer look at your specific setup and provide premium support.

    Plugin Support Michael Ti?a

    (@mikes41720)

    Hi,

    This thread has been marked as resolved due to a lack of activity.

    You’re always welcome to re-open this topic. Please read this post before opening a new request.

    Thanks for understanding!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Canonical url add ”’ is closed to new replies.