I´m using a lot of including while coding pages to keep the code a little bit more beutiful and avoid typing code multiple times.
example of index.php:
<?php
include 'header.php';
?>
<p> random HTML </p>
<?php
include 'foo.php';
?>
The 'problem' now is that clients are able to navigate to www.page.de/foo.php and see this content. Is there a PHP-way to solve this without playing on .htaccess?