I'm trying to block direct access to the pages of my site. Only access from an iframe should be allowed. Example
iframe page -> /path/to/iframe.html
anyotherpage.html-> should be visible only from the iframe in iframe.html
Is there any way to achieve this with htaccess?
You can try to check
%{HTTP_REFERER}
:In this rules iframe.php = page with iframe tag located. iframe.html = page which using as iframe
So, if you try to request iframe.html directly, you will get redirect to another page.