Can AMP Real URL be enabled for partial site?

Is it possible to enable Cloudflare AMP Real URL for a route subtree in my app?

We are a SaaS app with articles, and I want only articles to be AMP pages.

A similar question was asked and not answered previously: WordPress AMP only on posts - should I enable CloudFlare AMP feature if I use WordPress AMP plugin for it?.

There are no configuration options inside dash other than on/off:

Short answer - yes.

I know to keep it enabled even on websites not using AMP at all.
I’d call it a great feature “behind the scenes” which does the work for HTTP Signed Exchanges for your domain name :wink:

AMP Real URL allows AMP content to retain your original URLs when displayed in Google’s mobile search results.

Especially works perfect for a publisher(s) using the Google News app for mobile (Android).

From the docs:

Cloudflare AMP Real URL leverages signed HTTP exchanges to authenticate publishers’ content when served from Google’s AMP cache. When a supported browser is detected, AMP Real URL will create a signed exchange for content that is requested from your domain. When using a supported Chrome browser, the page is validated using a signed exchange and is displayed on the user’s device with your site’s original URL.

That’s up to developer’s will how he wants to have, which AMP features should be used and how the AMP HTML content would be generated.

Usually, that’s my approach with WordPress websites. I just have single.php file in the AMP plugin, which is used to display content of articles within the guidelines for AMP HTML. Plugin also automatically adds the “canonical” link to AMP URLs, therefore “amphtml” link meta tag to the original (normal) WordPress article URL → that’s how they are connected/cross-linked.
Therefore, the “web pages” like “Home, contact us, about us” are normal HTML pages and for them I don’t create AMP HTML version of the document.

Test and validate your AMP HTML using Google tool:

I cannot imagine my life without this feature back few years ago, which was the reason why I decided to start using Cloudflare :slight_smile: → single click and it works (otherwise, I had to figure out a lot of other stuff to make it work as expected “for Google”)

Don’t forget to add amp-access-control-allow-source-origin: HTTP header and send it from your origin host/server.

From my example, normal article URL:


AMP HTML article URL ( /amp/ at the end):


Normal other pages (non AMP HTML):



Another apps under the same domain (non AMP HTML):



So, from my above example, I assume that’s the “partial” from your question? :thinking:

Enable AMP Real URL option at CF dashboard, therefore for some /sub-dir-app/ make sure to create AMP HTML documents/content as specified in the guidelines, cross-link, verify code and you’re good to go :wink:

I hope above information helps you a bit with this :slight_smile:


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.