Using the Google AMP Cache
The Google AMP Cache stores valid AMPs and provides a consistently fast access to AMPs. It is available for anyone to use.
AMP Cache URL Format
When possible, the Google AMP Cache will create a subdomain for each AMP document's domain by first converting it from IDN (punycode) to UTF-8. The caches replaces every
- (dash) with
-- (2 dashes) and replace every
. (dot) with
- (dash). For example,
pub.com will map to
Here is AMP Cache URL for
The converted AMP Cache URL consists of the following parts:
ampbyexample-com: the publisher domain converted into a subdomain using the algorithm described above.
cdn.ampproject.org: the AMP Cache domain.
c: to indicate that it's an AMP document (there is also
ifor image and
rfor resources such as fonts).
s: indicating that the AMP Cache fetches the content from the origin using TLS (secure HTTPS).
ampbyexample.com/components/amp-img: the original URL excluding the scheme.
It is OK for URLs to include parameters in the query string, simply include these in the AMP Cache URL as well.
Redirect & Error Handling
Here are some examples for how the AMP Cache handles redirects and errors:
The AMP Cache follows redirects when resolving AMP URLs. For example, if an URL redirects to another AMP URL:
$ curl -I https://ampbyexample.com/amp-img.html HTTP/1.1 301 Moved Permanently Content-Type: text/html; charset=utf-8 Location: https://ampbyexample.com/components/amp-img/ ...
Then the AMP Cache will return the content of the resolved redirect for the original URL.
If you move the location of the AMP Files on your server, make sure to set up a redirect from the old location to the new one.
When a page is not found in the AMP Cache, it will show an error page and return a 404 status.
When a page is invalid AMP, the AMP Cache will return a 404 status.
If an URL returns a 5XX server errors, the AMP Cache will return a 404 status.
If the explanations on this page don't cover all of your questions feel free to reach out to other AMP users to discuss your exact use case.Go to Stack OverflowAn unexplained feature?
The AMP project strongly encourages your participation and contributions! We hope you'll become an ongoing participant in our open source community but we also welcome one-off contributions for the issues you're particularly passionate about.Edit sample on GitHub