<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]


    # 300 Redirections
    
    # Redirect for Android devices
    RewriteCond %{HTTP_USER_AGENT} (Android) [NC]
    RewriteRule ^.*/product/.*$ https://play.google.com/store/apps/details?id=com.wrteam.egrocer [R=301,L]
    # Add more redirections here as needed...


    # Redirect for iPhone/iPad devices
    RewriteCond %{HTTP_USER_AGENT} (iPhone|iPad) [NC]
    RewriteRule ^.*/product/.*$ https://testflight.apple.com/join/fcRe3J9F [R=302,L]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

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

</IfModule>

Header always set Access-Control-Allow-Origin *
Header always set Access-Control-Allow-Headers "Origin, Content-Type, Authorization, x-access-key"