Run this SQL command (using adminer or whatever) and you’ll get a list of mod_rewrite rules ready to paste into your .htaccess file.
SELECT CONCAT('RewriteRule ^', post_name, ' https://yoururl.com/', post_name, '/ [R=301,L]') as 'RewriteEngine On' FROM `wp_posts` WHERE `post_type` = 'post' AND `post_status` = 'publish' ORDER BY `post_name`
Change ‘post’ to ‘page’ if you want pages. Of course change your url.