# Derby website - Apache / LiteSpeed settings (generated by dev/build-live.ps1, do not edit by hand)

# Branded "Page not found" page for addresses that never existed
ErrorDocument 404 /404.html
Options -Indexes
DirectoryIndex index.html

# Never serve the lead backup file
<Files "leads-backup.php">
  Require all denied
</Files>

# Speed: compress text files
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css application/javascript text/javascript application/json application/xml image/svg+xml
</IfModule>

# Speed: let browsers keep files (pages always re-checked, so updates show at once)
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 day"
  ExpiresByType text/html "access plus 0 seconds"
  ExpiresByType text/css "access plus 7 days"
  ExpiresByType application/javascript "access plus 7 days"
  ExpiresByType text/javascript "access plus 7 days"
  ExpiresByType image/jpeg "access plus 30 days"
  ExpiresByType image/png "access plus 30 days"
  ExpiresByType image/webp "access plus 30 days"
  ExpiresByType image/svg+xml "access plus 30 days"
  ExpiresByType image/x-icon "access plus 30 days"
</IfModule>

# Security headers
<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On

# 1. ONE main address (like linkedin.com): https://derbydomesticworkerservices.com
#    www., http:// and any other Derby domain pointed at this hosting are sent there.
RewriteCond %{HTTP_HOST} ^www\.derbydomesticworkerservices\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)?derbydomesticworkerservices\.(ae|net|org|co|info)$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)?derbydomesticworker(s)?\.(com|ae)$ [NC]
RewriteRule ^ https://derbydomesticworkerservices.com%{REQUEST_URI} [R=301,L,NE]

RewriteCond %{HTTP_HOST} ^derbydomesticworkerservices\.com$ [NC]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://derbydomesticworkerservices.com%{REQUEST_URI} [R=301,L,NE]

# 2. Old website addresses -> new pages
# BEGIN old addresses
RewriteRule "^maid-visa-service/?$" "/" [R=301,L,NC]
RewriteRule "^recruitment/?$" "/articles/nanny-visa-dubai/" [R=301,L,NC]
RewriteRule "^about(-us)?/?$" "/" [R=301,L,NC]
RewriteRule "^blog(/.*)?$" "/articles/" [R=301,L,NC]
RewriteRule "^author(/.*)?$" "/articles/" [R=301,L,NC]
RewriteRule "^category(/.*)?$" "/articles/" [R=301,L,NC]
RewriteRule "^tag(/.*)?$" "/articles/" [R=301,L,NC]
RewriteRule "^feed(/.*)?$" "/articles/" [R=301,L,NC]
RewriteRule "^leads/?$" "/contact/" [R=301,L,NC]
RewriteRule "^contact-us/?$" "/contact/" [R=301,L,NC]
RewriteRule "^a-step-by-step-process-for-expatriates-to-apply-maid-visa-in-dubai/?$" "/articles/how-to-sponsor-maid-visa-dubai/" [R=301,L,NC]
RewriteRule "^benefits-of-hiring-full-time-maids-from-tadbeer-maid-service-agency-in-dubai/?$" "/articles/hire-full-time-maid-dubai-checklist/" [R=301,L,NC]
RewriteRule "^Privacy Policy/?$" "/privacy-policy/" [R=301,L,NC]
RewriteRule "^privacy/?$" "/privacy-policy/" [R=301,L,NC]
RewriteRule "^(offers|full-time-maids|contact|articles|privacy-policy|thank-you)\.html$" "/$1/" [R=301,L,NC]
RewriteRule "^maid-visa-cost-dubai(\.html)?/?$" "/articles/maid-visa-cost-dubai/" [R=301,L,NC]
RewriteRule "^maid-visa-requirements-dubai(\.html)?/?$" "/articles/maid-visa-requirements-dubai/" [R=301,L,NC]
RewriteRule "^how-to-sponsor-maid-visa-dubai(\.html)?/?$" "/articles/how-to-sponsor-maid-visa-dubai/" [R=301,L,NC]
RewriteRule "^tadbeer-maid-visa(\.html)?/?$" "/articles/tadbeer-maid-visa/" [R=301,L,NC]
RewriteRule "^maid-visa-abu-dhabi(\.html)?/?$" "/articles/maid-visa-abu-dhabi/" [R=301,L,NC]
RewriteRule "^maid-visa-sharjah(\.html)?/?$" "/articles/maid-visa-sharjah/" [R=301,L,NC]
RewriteRule "^nanny-visa-dubai(\.html)?/?$" "/articles/nanny-visa-dubai/" [R=301,L,NC]
RewriteRule "^maid-visa-golden-visa-uae-nationals(\.html)?/?$" "/articles/maid-visa-golden-visa-uae-nationals/" [R=301,L,NC]
RewriteRule "^indian-maid-visa-dubai(\.html)?/?$" "/articles/indian-maid-visa-dubai/" [R=301,L,NC]
RewriteRule "^private-sponsorship-vs-maid-visa-company(\.html)?/?$" "/articles/private-sponsorship-vs-maid-visa-company/" [R=301,L,NC]
RewriteRule "^full-time-maid-dubai-live-in-vs-live-out(\.html)?/?$" "/articles/full-time-maid-dubai-live-in-vs-live-out/" [R=301,L,NC]
RewriteRule "^hire-full-time-maid-dubai-checklist(\.html)?/?$" "/articles/hire-full-time-maid-dubai-checklist/" [R=301,L,NC]
# END old addresses

# /index.html or /index.php typed by a visitor -> /  (THE_REQUEST check avoids a loop with DirectoryIndex)
RewriteCond %{THE_REQUEST} \s/+index\.(php|html)[\s?] [NC]
RewriteRule ^index\.(php|html)$ / [R=301,L,NC]
</IfModule>
