Support » Plugin: AMP » Actual AMP URL is different from URL

  • My actual amp URL is:

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


    It is custom.

    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;

    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.