Options +FollowSymLinks -Indexes -MultiViews
RewriteEngine On
RewriteRule ^en/book-a-service.html(/.*)?$ https://service.mini-dubai.com$1 [R=301,L]
RewriteRule ^ar/book-a-service.html(/.*)?$ https://service.mini-dubai.com$1 [R=301,L]
RewriteRule ^book-a-service.html(/.*)?$ https://service.mini-dubai.com$1 [R=301,L]

############################################
#Redirect to www.

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

############################################
## never rewrite for existing files, directories and links

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l



############################################
## Never rewrite for not existing js|css|jpg|gif|png|jpeg|swf

RewriteCond %{REQUEST_URI} !^(.*).(js|css|jpg|gif|png|jpeg|swf)$

############################################
## Rewrite all other requests to index.phpz

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

############################################
## Deflate 

RewriteCond %{REQUEST_URI} .gitignore [NC]
RewriteRule .* /index [R=403,L]
#<IfModule mod_php7.c>
#    php_value session.cookie_secure 1
#</IfModule> 
AddDefaultCharset UTF-8
<IfModule mod_deflate.c>
	SetOutputFilter DEFLATE
    AddOutPutFilterByType DEFLATE text/html text/plain text/xml text/css text/js text/javascript application/javascript
    <IfModule mod_setenvif.c>
        # Netscape 4.x has some problems...
        BrowserMatch ^Mozilla/4 gzip-only-text/html

        # Netscape 4.06-4.08 have some more problems
        BrowserMatch ^Mozilla/4\.0[678] no-gzip

        # MSIE masquerades as Netscape, but it is fine
        # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

        # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
        # the above regex won't work. You can use the following
        # workaround to get the desired effect:
        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

        # Don't compress images
        SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
    </IfModule>

    <IfModule mod_headers.c>
        # Make sure proxies don't deliver the wrong content
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
</IfModule>


############################################
## Set expire header for static contents

ExpiresActive On
ExpiresDefault A0

# 1 WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
ExpiresDefault A604800
</FilesMatch>

# 1 WEEK
<FilesMatch "\.(txt|xml|js|ico|css)$">
ExpiresDefault A604800
</FilesMatch>

# 1 WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>

# 1 WEEK
<FilesMatch "\.(txt|xml|js|ico|css)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
## Disable PHP|Perl|Ruby in Uploads Folder
RewriteRule ^public/uploads/.*\.(php|rb|py)$ - [F,L,NC]
Header always edit Set-Cookie (.*) "$1; HTTPOnly; Secure"
# Set the Path attribute to root
# Header edit Set-Cookie ^(.*)$ $1;SameSite=Strict
# Header set Content-Security-Policy "default-src 'self'; img-src 'self' https://cdn.findyourbmw.ae; script-src 'self' 'unsafe-inline'; style-src 'self' https://cdn.findyourbmw.ae 'unsafe-inline';"

# Block .git access
RewriteRule (^|/)\.git(/|$) - [F,L,NC]

# Block nginx directory access
RewriteRule ^nginx(/|$) - [F,L,NC]
RewriteRule ^php-fpm(/|$) - [F,L,NC]

# Block Docker-related files
RewriteRule (^|/)(Dockerfile|docker-compose\.yml|docker-compose\.yaml)$ - [F,L,NC]


# Block sensitive file types
RewriteRule \.(sql|zip|rar|tar|gz|7z|bak|log|ini|conf|env|sh|pem|key|yml|nginx)$ - [F,L,NC]

RewriteRule ^vendor(/|$) - [F,L,NC]
RewriteRule ^devtmp(/|$) - [F,L,NC]
RewriteRule ^error_log(/|$) - [F,L,NC]