The
RewriteRule ^(\d{4})\/(\d{2})\/(\d{2})\/(.*?)$ /index.php?date=$1-$2-$3
…which rewrites http://example.org/2016/02/25/foobar to http://example.org/index.php?date=2016-02-25 and requires the base URL be set to http://example.org/ for local links to work.
Filed b/27356051 internally, because this first has to be support in AMP cache serving because it can be made valid.
Closing this old issue. <base href=/>
is now valid. We may extend this in the future to other href
values, but this works for the given use case.
While my first AMP pages have just gone live (e.g., https://cdn.ampproject.org/c/s/blog.tomayac.com/categories/technical), it seems like <base href=/>
is not back-translated to the origin URL, as all links currently 404
, e.g., https://cdn.ampproject.org/2015/06/24/mediterranea-js-trip-report-151125 that should actually point to https://blog.tomayac.com/2015/06/24/mediterranea-js-trip-report-151125 (a currently invalid AMP page, but irrelevant for the actual issue that <base href="/">
served from the AMP Cache forgets it should actually point to <base href="https://blog.tomayac.com/">
, which is not allowed as a value).
(CC: @Gregable @cramforce)
That seems buggy, indeed. I would have expected the base tag to be removed from the output document and the links to be rewritten.
Reopened our internal issue.
This has been fixed on the cache. New documents or documents that change and are refreshed on the cache should have the correct tags. Still working on reprocessing existing documents.
@tomayac thanks for opening that. It's very common indeed. I have the same issue too, and I use the base tag for the same purpose as you mention.
However attn @Gregable @cramforce it seems this hasn't been fully fixed. Trying to validate my amp pages, I get the error [attribute 'href' in tag 'base' is set to the invalid value]. You can try a test version of it here. http://test1.shoppinginformer.com/amp-tst/stores/Lacoste/363
@sham77: We only allow /
.
Any progress on allowing actual URLs in the href
attribute?
Most helpful comment
Any progress on allowing actual URLs in the
href
attribute?