Enabling mod_rewrite and fixing some custom permalinks’ issues, warned on also by some plugins.

210124
Many times trying to make your permalinks more friendly to SEO, or after you migrated your site to a new host or changed your domain, you face issues with your settings for permalinks. Some plugins related to changing permalinks also warns you about issues like mod_rewrite is required, or .htaccess issues. The .htaccess is a distributed configuration file, and is how Apache handles configuration changes on a per-directory basis. See more at: https://wordpress.org/support/article/htaccess/.
Indeed, when you change your permalinks, you have to have the module mod_rewrite of your Apache server enabled.
Check if the module mod_rewrite is enabled
If you work on a local machine this is not a big deal. Create a .php file, e.g. name it php-info.php, put just the following line inside it:
<?php phpinfo();?>
And then go to your browser and check it:
http://localhost/php-info.php
Actually, search for the mod_rewrite:

In the above case, the mod_rewrite module is not present. So we have to enable (install) it.
Enable the mod_rewrite module
Usually enabling a module can be done using the a2enmod command:
$ sudo a2enmod rewrite
a2enmod is a well-known command to enable an Apache module, and we usually use it to enable a specific Apache module. However, a2enmod is written for a Debian distribution (e.g. Debian, Ubuntu, etc.) and it is a Debian-specific script for the Apache server package.
In a macOS system, we can achieve the same thing by editing the Apache main configuration file /usr/local/etc/httpd/httpd.conf and uncommenting the line for the rewrite module:

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

Then restart Apache server:
➜ ~ apachectl restart
After that check again that the module is enabled:

As you can see above, the module is sown enabled.
Now your site’s custom permalinks, as well as plugins requiring mod_rewrite, should work OK!
NB: In a Synology NAS server the Apache main configuration file is located at:
/var/packages/Apache2.4/target/usr/local/etc/apache24/conf/ httpd24.conf. So, you can search inside it and check if:LoadModule rewrite_module modules/mod_rewrite.so
is enabled (uncommented). If no, uncommend it, accordingly.
That’s it!
Thank you for reading!