AMP IFrame 404 Error. ampiframe.php file is missing.

<AMP-IFrame> 404 Error. AMP IFrame file is missing. Users will see the following error message: “Not Found. The requested URL /ampiframe.php was not found on this server.”

Respectively the shopping cart button, along with custom options and configurable options on your Magento 2 AMP pages, are missing. Please see the screenshot below:

Not-found-iframe.png

Issue Description

Most likely, you are experiencing this 404 error right after installing the AMP extension via the composer. Sometimes the iframe file can be accidentally deleted or renamed, and therefore the AMP Iframe source is missing.

Solution

Step 1

Check your AMP Magento Extension configuration. The AMP Iframe path field will display a location and the name of your AMP Iframe file as displayed below:

Iframe-path.png

Step 2

Check your Magento web root folder. Depending on your web server settings, the Magento DocumentRoot may be located in:

/path/to/magento2/pub

or

/path/to/magento2/

Now check the above folders. Most likely, the “ampiframe.php” is simply missing.

Step 3

Copy the “ampiframe.php” file (provided with the module) to your Magento 2 webroot directory.

If you are serving files from the pub/ directory, then you must copy the “ampiframe.php” to pub/ folder:

cp /path/to/magento2/vendor/plumrocket/module-pramp/ampiframe.php /path/to/magento2/pub

Otherwise, please copy the “ampiframe.php” to your Magento 2 default webroot:

cp /path/to/magento2/vendor/plumrocket/module-pramp/ampiframe.php /path/to/magento2/

Step 4

Now go back to your browser and refresh the AMP product page. The AMP Iframe should be displayed correctly.

Was this article helpful?