How can PHP developers handle session management when users reject cookies and rely solely on URL parameters for session tracking?

When users reject cookies and rely solely on URL parameters for session tracking, PHP developers can append the session ID to all URLs on the website. This way, each page request will include the session ID in the URL, allowing the server to identify the user session without the need for cookies.

<?php
session_start();

// Generate a unique session ID
$session_id = session_id();

// Append the session ID to all URLs on the website
function append_session_id($url, $session_id) {
    if (strpos($url, '?') !== false) {
        $url .= '&PHPSESSID=' . $session_id;
    } else {
        $url .= '?PHPSESSID=' . $session_id;
    }
    return $url;
}

// Usage example
$homepage_url = append_session_id('http://example.com/homepage', $session_id);
echo $homepage_url;
?>