如何将Wordpress帖子中的链接重定向到子目录?

I am moving a WordPress site on my own server. It's set up on /var/www/public_html/wp/wordpress. So to go to my site, you'd go to example.com/wp/wordpress/. I added this line to public_html/.htaccess:

RewriteRule ^$ /wp/wordpress/index.php [L]

So now example.com will go straight to WordPress. However, there are now a lot of broken links inside posts. These links usually point to example.com/webpage; the actual page can be found at example.com/wp/wordpress/index.php/webpage.

How do I properly redirect these links?

I can also run SQL commands on the WordPress database to fix the links directly (I'm using PHPMyAdmin).

Edit: Here are some screenshots. Apparently I'm not allowed to embed images yet, but here are some links.

Here's a broken link, inside the post

Here's the resulting 404, when following that link

And here's where the link is supposed to point

Just changing that one link wouldn't be a problem, but there are too many posts to go through to do it manually.

Try going to your WordPress Admin Dashboard and go to permalinks and just click the save button even if you haven't change any setting on the permalinks settings.