What are the best practices for ensuring that all pages can access CSS and JavaScript files in specific directories when using PHP includes?

When using PHP includes, it's important to ensure that all pages can access CSS and JavaScript files in specific directories by using relative paths in the link or script tags. One way to achieve this is by defining a base URL constant in a separate configuration file and using it to construct the paths to the CSS and JavaScript files.

// config.php
define('BASE_URL', 'http://example.com');

// header.php
<link rel="stylesheet" type="text/css" href="<?php echo BASE_URL; ?>/css/styles.css">

// footer.php
<script src="<?php echo BASE_URL; ?>/js/scripts.js"></script>