Solution 1:

Try this rule in test/.htaccess:

DirectoryIndex index.php
<IfModule mod_rewrite.c>

    RewriteEngine On
    RewriteBase /test/

    RewriteRule ^$ public/index.php [L]

    RewriteRule ^((?!public/).*)$ public/$1 [L,NC]

</IfModule>

Solution 2:

this is the magic script i use (add to the .htaccess in public_html)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Solution 3:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^$ public/index.php [L]
    RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
</IfModule>