What is the best practice for structuring URLs for PHP files and images in a website with multiple subfolders?

When structuring URLs for PHP files and images in a website with multiple subfolders, it is best practice to use relative paths to ensure portability and ease of maintenance. This means avoiding hardcoding full paths and instead using paths that are relative to the current file location. By doing this, you can easily move files around within the folder structure without breaking links or requiring extensive updates.

// Example of using relative paths for including PHP files and displaying images

// Including a PHP file from a subfolder
include 'subfolder/file.php';

// Displaying an image from a subfolder
echo '<img src="subfolder/image.jpg" alt="Image">';