Support » Plugin: AMP WP - Google AMP For WordPress » Failed validation because of malformed url

  • Resolved peteto2006

    (@peteto2006)


    I really love your plugin. I’ve tested all the others and this is the one that is easy to set up and runs smoothly.
    But now about my problem – when running validation, I got the following validation issues:
    Malformed URL ‘https:///mysuper.site/site-category/%d0%b8%d0%b7%d1%80%d0%b0%d0%b1%d0%be%d1%82%d0%ba%d0%b0-%d0%bd%d0%b0-%d1%81%d0%bf%d0%b5%d1%86%d0%b8%d0%b0%d0%bb%d0%b8%d0%b7%d0%b8%d1%80%d0%b0%d0%bd%d0%b8-%d1%81%d0%b0%d0%b9%d1%82%d0%be%d0%b2%d0%b5/amp/’
    And I got over 20 instances like that. I see the link is https:/// (with 3 // instead of 2). Is that the problem? Where is that aditional / coming from?

    And since I’m using Yoast – should I set anything aditionally? I saw the plugin is 100% Yoast compitable, but should I do anything? I didn’t see anything in the settings…

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hey, i found a solution for me :

    Go to => /wp-content/plugins/amp-wp/includes/class-amp-wp-content-sanitizer.php

    Search : Line 346 : Function transform_to_end_point_amp

    Replace $url by :

    $url = sprintf( ‘%s:%s/%s’, $parsed[‘scheme’], $parsed[‘host’], ltrim( $path, ‘/’ ) );
    $url = trailingslashit( $url ) . Amp_WP_Public::SLUG . ‘/’;

    Enjoy

    Thank you!!!

    That did the trick!

    Thanks again. My amp is now validated.

    I guess I’ll have to do it with every plugin update.

    Plugin Contributor Mohsin Rafique

    (@mohsinrafique)

    Hi @peteto2006,

    You really don’t need to fix that error in our upcoming release. We will fix this error in our next release.

    For Yoast SEO, you really don’t need to do anything additional.

    @groslebrave thank you for helping us to find the bug in the code.

    Thanks,

    Plugin Contributor Mohsin Rafique

    (@mohsinrafique)

    Hi @peteto2006,

    Despite @groslebrave having a good suggestion, a better way to fix Malformed URL error, please do the following for a more accurate solution:

    Step 1: Go to path /wp-content/plugins/amp-wp/includes/

    Step 2: Open file class-amp-wp-content-sanitizer.php

    Step 3: Search function protected static function transform_to_end_point_amp at line 346.

    Step 4: Replace line no 368 return amp_wp_url_trim_end_slash( $url ); with return $url;

    Let us know if that helps.

    Thanks,

    I don’t know what’s causing it, but Google Webmaster is giving me errors.
    Because it indexes the url the following way:
    For ex.:
    https://mysuper.site/mysuper.site/amp
    I.e. it’s addind the url twice before adding /amp
    If I enter the url the correct way and add /amp all is working, but somehow Google indexes the url the way described above.

    Here’s another example:
    https://mysuper.site/site/facebook-like-box/mysuper.site/site/facebook-like-box/amp/

    That way Google doesn’t index the amp 🙁

    Plugin Contributor Mohsin Rafique

    (@mohsinrafique)

    Hi @peteto2006,

    Provided URLs are indexed on google already. When Google re-indexes them, these issues will be resolved automatically. We didn’t find anymore critical issues on your site.

    Also, your AMP site layout seems to be broken, have you done any code customization on it?

    Thanks,

    Plugin Contributor Mohsin Rafique

    (@mohsinrafique)

    Hi @peteto2006,

    We have released a new version. Please update and let us know if you still face any issues.

    Note: Please clear your browser’s cache to see the changes. If you are using any caching plugin/software then please clear your server cache. This would resolve the layout issues, if there are any.

    Thanks,

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.