Support » Plugins and Hacks » AMP » Actual AMP URL is different from URL

  • My actual amp URL is:
    http://post-url/?amp=1

    But the link declared in the header of my non-AMP pages is
    <link rel=”amphtml” href=”http://post-url/amp/” />

    Maybe this is the reason why my APM pages are still not index. Any advise on how to fix this?

    • This topic was modified 3 months, 2 weeks ago by  riccian. Reason: added additional info
Viewing 4 replies - 1 through 4 (of 4 total)
  • The title should be “Actual AMP URL is different from the <link rel=”amphtml”> URL”

    Plugin Author Mohammad Jangda

    (@batmoo)


    What is your permalink structure set to? (i.e. the value at Settings > Permalinks)

    It is custom.

    domain.com/%category%/%postname%/

    Plugin Author Mohammad Jangda

    (@batmoo)


    If you want to force the AMP URL to the querystring version, in 0.4 you can do:

    
    add_filter( 'amp_pre_get_permalink', 'riccian_force_querystring_permalink', 10, 2 );
    
    function riccian_force_querystring_permalink( $url, $post_id ) {
        $permalink = get_permalink( $post_id );
        $url = add_query_arg( AMP_QUERY_VAR, 1, $permalink );
        return $url;
    }
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.