RewriteEngine on
Options All -Indexes

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} (www\.)?localhost
RewriteRule (.*) https://%{HTTP_HOST} [L,R=301]

RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]