• 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 7 years, 6 months ago by riccian. Reason: added additional info
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter riccian

    (@riccian)

    The title should be “Actual AMP URL is different from the <link rel=”amphtml”> URL”

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

    Thread Starter riccian

    (@riccian)

    It is custom.

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

    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;
    }
    
    onurcelik

    (@onurcelik)

    Hey @batmoo how can I remove the slash at the end of the amphtml url? Should I use “amp_pre_get_permalink” filter? And where to implement the code?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Actual AMP URL is different from URL’ is closed to new replies.