RewriteEngine On
RewriteBase /{$site_dir}
RewriteRule ^\.htaccess$ - [F]
#canonicalization do not remove!
#{%canonic_rules%}
#end canonicalization
RewriteRule ^index\.html$ {$site_url} [R=permanent,L]
#301 redirect

#end 301
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/{$site_dir}public/.*$
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ public/index.php [NC,L]