Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

?/amp why are my amp pages like this #474

Closed
jillianok opened this issue Sep 15, 2016 · 9 comments
Closed

?/amp why are my amp pages like this #474

jillianok opened this issue Sep 15, 2016 · 9 comments

Comments

@jillianok
Copy link

I have paid a computer person to install plugin and setup amp on my website. However to see the amp pages you have do
mydomain.com.au/?amp. not /amp. Why is this. I have not seen any other amp pages with the question mark ?

@cayci
Copy link
Contributor

cayci commented Sep 15, 2016

The question mark marks the beginning of a query string. Please refer to a simple explanation of query strings.

From the WordPress.org plugin directory:
How can I view the AMP version of my site?"
To view the AMP version, add /?amp at the end of your url.

@DrLightman
Copy link

With permalinks enabled you should have /amp, not "amp" as a GET parameter

@amedina
Copy link
Member

amedina commented Jul 4, 2017

Make sure that permalinks are enabled in your site. And thanks for using the plugin :)

@amedina amedina closed this as completed Jul 4, 2017
@emresque
Copy link

Hi,

I still get the question mark although i have permalinks enabled and my normal pages and posts have urls without question marks. And when i just type /amp et the end of my urls it goes 404. Can anybody help me on this? (example page-->seo hizmeti

@westonruter
Copy link
Member

@emresque The query var is used for pages and any other non-hierarchical post type. Please see https://wordpress.org/support/topic/0-6-0-not-working-for-pages/#post-9903766

@emresque
Copy link

ah now i see, it is true that for blog posts i have normal urls without the question mark..good to know that it is ok from google's point of view..thanks for the information Weston!

@CVANL
Copy link

CVANL commented Apr 6, 2020

Hi Folks, I started using AMP at my wordpress website 4 days ago. In the first 2 days my amp pages were detected with /amp/ at the end. But since yesterday it has been changed to ?amp

The problem is that website is now redirecting the browser at pages from /amp/ to the desktop url without amp. this is an example of a page:

  1. https://coronavirusactueel.nl/corona-kaart-nederland/amp/

When you visit this url, the amp is not showing up. But there is an AMP version 100% sure.

  1. https://coronavirusactueel.nl/burgemeesters-bespreken-overlast-motorrijders/amp/

This is an example if a post and when you visit this url it's redirected to ?amp and that's an AMP version of the post.

Could it be that my caching plugin wp-rocket or the google mod_pagespeed causes this problem? Because I started using them since yesterday.

I am afraid that this will mess up my google indexing and that I will have duplicate pages for more that 2000 posts.

When you search in google: site:coronavirusactueel.nl amp you can see that /amp/ is what google indexed. But these pages don't work anymore.

Could somebody advice me what to do?

Thanks! And greetings from the Netherlands.

Ray

@westonruter
Copy link
Member

@CVANL I presume you used a different AMP plugin previously?

If you look at the source code of https://coronavirusactueel.nl/corona-kaart-nederland/ you'll see:

<link rel="amphtml" href="https://coronavirusactueel.nl/corona-kaart-nederland/?amp">

So the AMP version of a page (or another hierarchical post type) does not end in /amp/ but ?amp.

Nevertheless a post like https://coronavirusactueel.nl/burgemeesters-bespreken-overlast-motorrijders/ has:

<link rel="amphtml" href="https://coronavirusactueel.nl/burgemeesters-bespreken-overlast-motorrijders/?amp">

So for the AMP version of that post ends in ?amp.

Note that the inconsistency of URLs for posts and pages will be addressed in #2204 where we'll default to ?amp for all URLs.

Google's index will update to to use the new AMP URLs.

Nevertheless, I'm not sure why attempting to access https://coronavirusactueel.nl/corona-kaart-nederland/amp/ is redirecting to https://coronavirusactueel.nl/corona-kaart-nederland/ and not https://coronavirusactueel.nl/corona-kaart-nederland/?amp

It's most likely because the AMP plugin doesn't even try to add the /amp/ endpoint to pages:

add_rewrite_endpoint( amp_get_slug(), EP_PERMALINK );

Because of this, WordPress's own canonical redirects are kicking in.

What you could in the short term while waiting for Google to re-index your pages is add a plugin that does this:

namespace AMP_Register_Page_Endpoint;

function add_amp_endpoint() {
	\add_rewrite_endpoint( amp_get_slug(), EP_PERMALINK | EP_PAGES );
}

register_activation_hook( __FILE__, function () {
	flush_rewrite_rules( false );
	add_amp_endpoint();
} );

add_action( 'init', function() {
	add_amp_endpoint();
} );

I've added this to an existing extension plugin that deals with other aspects of AMP endpoint migration which you can use to do this: https://gist.github.com/westonruter/6b7d3b168711ee03c4ee29b68c3719b2

I've added a link to installation instructions in the comments.

@DrLightman
Copy link

Try visiting Settings | Permalinks page of your dashboard to force a flush of rewrite rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants