The easiest way to achieve is like most other things in WordPress, install a plugin to do the work.

You should only download and use plugins that are found in the plugin section of the WordPress.org website.

A good practice is to only use plugins that have been updated recently and that has more than 10 000 downloads.

This is a reputable WordPress Plugin.