Php in iframe not working

I am trying to embed a simple php file in an iframe, but it is not working. A post suggests, this should be easy.

What I add into my Grav page:
<iframe id="test_iframe" title="test" src="test.php" width="600" height="600"></iframe>

However, this does not work. I get the Error 404. Interestingly, in the iframe, I can see the Grav icon and the menu of my website, something I would not expect or need inside the iframe.

When I replace the php reference with html:
<iframe id="test_iframe" title="test" src="test.html" width="600" height="600"></iframe>
the page shows up.

This is the content of test.html:


This is a HTML page inside IFRAME.


This is the content of test.php:


echo <<<EOL

This is a PHP page inside IFRAME.



Both the test.html and test.php reside in the page folder (01.home).
I am using Grav v1.7.35.

(My end goal is to reference in an iframe a locally stored map with tiles, i.e. a page referencing images from a subfolder.)

Looks like an issue with your webserver config.
Try a complete URL with the PHP file, like “

It works with a complete URL (pointing outside the Grav folder tree).

Great! Thanks for the feedback.

Well, it does not solve my problem, though. Why can’t I achieve the same having the php file within the Grav folder structure? I suppose I can, but I haven’t figured out how yet. Thanks.

You can’t because paths to PHP files inside the Grav tree are rewritten via .htaccess. So you’ll have to keep it outside.

Thank you for the clarification!