You can use URL rewriting techniques to convert the dynamic URLs into static URLs by changing it'd format.
In your .htaccess file you can use something like this -
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ detail.php?url=$1 [L,QSA]
You can then parse the URL and retrieve the required data from the database -
$url = $_GET['url'];
$parts = explode('/', $url);
$article_id = $parts[1];
$stmt = $pdo->prepare('SELECT * FROM articles WHERE id = :id');
$stmt->execute(['id' => $article_id]);
$article = $stmt->fetch();
echo '<h1>' . $article['title'] . '</h1>';
echo '<p>' . $article['content'] . '</p>';