How to do mod rewrite public folder

What is your apache2 configuration.

Usually in the linux, we set web root to:

/var/www/html/suitecrm/public

Then in .htaccess file, it is set to:

/legacy/

The .htaccess file located at /public/legacy/ folder.