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

    RewriteEngine On

    # Live — https://meatworx.in/
    RewriteCond %{HTTP_HOST} ^(www\.)?meatworx\.in$ [NC]
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://meatworx.in%{REQUEST_URI} [R=301,L]

    RewriteCond %{HTTP_HOST} ^www\.meatworx\.in$ [NC]
    RewriteRule ^ https://meatworx.in%{REQUEST_URI} [R=301,L]

    # Browser asked for /public — send them to the clean address.
    RewriteCond %{HTTP_HOST} ^(www\.)?meatworx\.in$ [NC]
    RewriteCond %{THE_REQUEST} \s/+public(?:/|\s|\?) [NC]
    RewriteRule ^(.*)$ https://meatworx.in/$1 [R=301,L,NE]

    # Local — http://localhost/ambikesh/meatworx/web
    # RewriteCond %{HTTP_HOST} localhost [NC]
    # RewriteCond %{THE_REQUEST} \s/+ambikesh/meatworx/web/public(?:/|\s|\?) [NC]
    # RewriteRule ^(.*)$ /ambikesh/meatworx/web/$1 [R=301,L,NE]

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

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

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
