RewriteEngine on

# Do not redirect requests to the storage folder
RewriteCond %{REQUEST_URI} ^/storage/ [NC]
RewriteRule ^ - [L]

# Remove trailing slashes
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Redirect everything else to public folder
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
