What are some best practices for structuring a PHP website to ensure scalability and maintainability?

Issue: To ensure scalability and maintainability of a PHP website, it is essential to follow best practices such as organizing code into separate files, using a proper directory structure, implementing design patterns, and optimizing database queries. Code snippet:

// Example of organizing code into separate files
// index.php
require_once 'config.php';
require_once 'functions.php';
require_once 'header.php';

// config.php
define('DB_HOST', 'localhost');
define('DB_USER', 'username');
define('DB_PASS', 'password');
define('DB_NAME', 'database');

// functions.php
function get_users() {
    // Database query to retrieve users
}

// header.php
<html>
<head>
    <title>My PHP Website</title>
</head>
<body>