
# Redirect /public/... to /
RewriteCond %{REQUEST_URI} ^/public/(.*)$ [NC]
RewriteRule ^public/(.*)$ https://trucareclinics.ae/$1 [L,R=301]

# Redirect /public only to /
RewriteCond %{REQUEST_URI} ^/public$ [NC]
RewriteRule ^public$ https://trucareclinics.ae/ [L,R=301]

#Redirect to www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]

# OR redirect to non-www
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]

# Redirect public to / 

RewriteCond %{REQUEST_URI} ^/public/(.*)$
RewriteRule ^public/(.*)$ /$1 [L,R=301]

<IfModule mod_rewrite.c>
    RewriteEngine On

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

</IfModule>

# Enable Gzip/Brotli
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css application/javascript
</IfModule>

# Browser Caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/webp "access plus 6 months"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
</IfModule>

<FilesMatch "^\.env|\.git|composer\.(json|lock)|package\.(json|lock)|artisan|server\.php|webpack\.mix\.js|vite\.config\.js$">
    Order allow,deny
    Deny from all
</FilesMatch>

RedirectMatch 403 ^/(app|bootstrap|config|database|routes|resources)/

Options -Indexes