Are there alternative solutions to mod_rewrite for achieving virtual duplication of content across multiple websites using PHP?

The issue of achieving virtual duplication of content across multiple websites using PHP without relying on mod_rewrite can be solved by using PHP's header function to redirect requests to a single PHP script that serves the content for all websites. By parsing the requested URL and dynamically generating the content based on the URL parameters, we can effectively create the illusion of duplicated content across multiple websites.

<?php
// Get the requested URL
$request_url = $_SERVER['REQUEST_URI'];

// Parse the URL to determine which content to display
// For example, if the URL is /website1/page1, display content for website1 page1
// If the URL is /website2/page2, display content for website2 page2

// Dynamically generate and display the content based on the URL parameters
switch ($request_url) {
    case '/website1/page1':
        echo 'Content for Website 1 Page 1';
        break;
    case '/website2/page2':
        echo 'Content for Website 2 Page 2';
        break;
    default:
        echo 'Page not found';
}
?>