# Millbrae Locksmiths - Apache configuration
Options -Indexes -MultiViews
ServerSignature Off
DirectoryIndex index.html
ErrorDocument 404 /404.html
AddDefaultCharset utf-8
AddType image/svg+xml .svg
AddType font/woff2 .woff2
AddType application/manifest+json .webmanifest

<IfModule mod_rewrite.c>
RewriteEngine On
# Block TRACE/TRACK
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) [NC]
RewriteRule .* - [F,L]
# Block hidden files and folders except /.well-known/
RewriteRule (^|/)\.(?!well-known/) - [F,L]
# Force HTTPS and non-www
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://millbraelocksmiths.net/$1 [R=301,L]
# Homepage duplicates
RewriteCond %{THE_REQUEST} \s/+index\.(html|php)[\s?] [NC]
RewriteRule ^index\.(html|php)$ https://millbraelocksmiths.net/ [R=301,L]
# Trailing slash after .html
RewriteRule ^(.+\.html)/+$ https://millbraelocksmiths.net/$1 [R=301,L]
# Consolidated / retired pages
RewriteRule ^24\-7\-emergency\-locksmith\.html$ https://millbraelocksmiths.net/what-emergency-locksmiths-do.html [R=301,L]
RewriteRule ^24\-hour\-emergency\-locksmith\.html$ https://millbraelocksmiths.net/what-emergency-locksmiths-do.html [R=301,L]
RewriteRule ^24\-hour\-lock\-out\-service\.html$ https://millbraelocksmiths.net/blog24-hour-locksmith-what-to-expect.html [R=301,L]
RewriteRule ^apartment\-lock\-change\.html$ https://millbraelocksmiths.net/residential-locksmith.html [R=301,L]
RewriteRule ^apartment\-lockout\.html$ https://millbraelocksmiths.net/fast-reliable-lockout-service.html [R=301,L]
RewriteRule ^automotive\-lockout\.html$ https://millbraelocksmiths.net/car-lockouts-trust.html [R=301,L]
RewriteRule ^automotive\-locksmith0\.html$ https://millbraelocksmiths.net/car-lockouts-trust.html [R=301,L]
RewriteRule ^best\-locksmith\.html$ https://millbraelocksmiths.net/best-locksmith-claims-the-truth.html [R=301,L]
RewriteRule ^business\-locksmith\.html$ https://millbraelocksmiths.net/why-call-a-pro-for-business-lockouts.html [R=301,L]
RewriteRule ^car\-lockout\.html$ https://millbraelocksmiths.net/car-lockouts-trust.html [R=301,L]
RewriteRule ^chip\-key\-replacement\.html$ https://millbraelocksmiths.net/automotive-locksmith.html [R=301,L]
RewriteRule ^commercial\-lockout\.html$ https://millbraelocksmiths.net/fast-office-lockout-help.html [R=301,L]
RewriteRule ^commercial\-lockouts\.html$ https://millbraelocksmiths.net/fast-office-lockout-help.html [R=301,L]
RewriteRule ^commercial\-locksmith0\.html$ https://millbraelocksmiths.net/why-call-a-pro-for-business-lockouts.html [R=301,L]
RewriteRule ^emergency\-locksmith\-opening\.html$ https://millbraelocksmiths.net/what-emergency-locksmiths-do.html [R=301,L]
RewriteRule ^emergency\-locksmith\-services\.html$ https://millbraelocksmiths.net/what-emergency-locksmiths-do.html [R=301,L]
RewriteRule ^emergency\-locksmith0\.html$ https://millbraelocksmiths.net/what-emergency-locksmiths-do.html [R=301,L]
RewriteRule ^high\-security\-file\-cabinet\-lock\-out\.html$ https://millbraelocksmiths.net/commercial-locksmith.html [R=301,L]
RewriteRule ^ignition\-repair\.html$ https://millbraelocksmiths.net/automotive-locksmith.html [R=301,L]
RewriteRule ^key\-cutting\-for\-residential\.html$ https://millbraelocksmiths.net/residential-locksmith.html [R=301,L]
RewriteRule ^key\-fob\-replace\.html$ https://millbraelocksmiths.net/automotive-locksmith.html [R=301,L]
RewriteRule ^local\-locksmith\-service\.html$ https://millbraelocksmiths.net/local-locksmiths-respond-faster.html [R=301,L]
RewriteRule ^local\-mobile\-locksmith\.html$ https://millbraelocksmiths.net/hiring-a-mobile-locksmith.html [R=301,L]
RewriteRule ^lock\-change\-for\-a\-car\.html$ https://millbraelocksmiths.net/automotive-locksmith.html [R=301,L]
RewriteRule ^lock\-change\.html$ https://millbraelocksmiths.net/residential-locksmith.html [R=301,L]
RewriteRule ^lock\-out\.html$ https://millbraelocksmiths.net/24-7-locksmiths-for-lockouts.html [R=301,L]
RewriteRule ^lock\-repair\-services\.html$ https://millbraelocksmiths.net/residential-locksmith.html [R=301,L]
RewriteRule ^locks\-rekeyed\.html$ https://millbraelocksmiths.net/why-rekey-locks-when-moving-.html [R=301,L]
RewriteRule ^locks\-repair\.html$ https://millbraelocksmiths.net/commercial-locksmith.html [R=301,L]
RewriteRule ^locksmith\-24\-hour\-service\.html$ https://millbraelocksmiths.net/what-emergency-locksmiths-do.html [R=301,L]
RewriteRule ^locksmith\-close\-to\-me\.html$ https://millbraelocksmiths.net/locksmith-on-speed-dial.html [R=301,L]
RewriteRule ^locksmith\-mobile\-service\.html$ https://millbraelocksmiths.net/hiring-a-mobile-locksmith.html [R=301,L]
RewriteRule ^locksmith\-near\-me\-for\-car\.html$ https://millbraelocksmiths.net/car-lockouts-trust.html [R=301,L]
RewriteRule ^locksmith\-near\-me\.html$ https://millbraelocksmiths.net/locksmith-on-speed-dial.html [R=301,L]
RewriteRule ^locksmith\-service\.html$ https://millbraelocksmiths.net/10-key-locksmith-services.html [R=301,L]
RewriteRule ^nearest\-locksmith\.html$ https://millbraelocksmiths.net/locksmith-on-speed-dial.html [R=301,L]
RewriteRule ^professional\-locksmith\.html$ https://millbraelocksmiths.net/10-key-locksmith-services.html [R=301,L]
RewriteRule ^rekey\-locks\-residential\.html$ https://millbraelocksmiths.net/why-rekey-locks-when-moving-.html [R=301,L]
RewriteRule ^residential\-locksmith0\.html$ https://millbraelocksmiths.net/residential-locksmith.html [R=301,L]
RewriteRule ^seo\-links\-seo\-links\.html$ https://millbraelocksmiths.net/ [R=301,L]
RewriteRule ^top\-reasons\-to\-choose\-us\.html$ https://millbraelocksmiths.net/local-locksmiths-respond-faster.html [R=301,L]
RewriteRule ^trusted\-locksmith\.html$ https://millbraelocksmiths.net/best-locksmith-claims-the-truth.html [R=301,L]
RewriteRule ^unlock\-service\.html$ https://millbraelocksmiths.net/24-7-locksmiths-for-lockouts.html [R=301,L]
</IfModule>

<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Header always set Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'self'; object-src 'none'; upgrade-insecure-requests"
Header always set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "DENY"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=()"
Header always set Cross-Origin-Opener-Policy "same-origin"
Header always unset X-Powered-By
Header unset X-Powered-By
<FilesMatch "\.(html|php)$">
Header set Cache-Control "no-cache, must-revalidate"
</FilesMatch>
<FilesMatch "\.(css|js|svg|woff2|png|jpg|webp|ico)$">
Header set Cache-Control "public, max-age=2592000"
</FilesMatch>
</IfModule>

# Deny sensitive files
<FilesMatch "(^\.|^config.*\.php$|\.(md|py|sh|sql|bak|zip|log|ini|csv)$|~$)">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
</IfModule>
</FilesMatch>

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript text/javascript application/json image/svg+xml application/xml text/xml
</IfModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 0 seconds"
ExpiresByType text/html "access plus 0 seconds"
ExpiresByType text/css "access plus 30 days"
ExpiresByType application/javascript "access plus 30 days"
ExpiresByType text/javascript "access plus 30 days"
ExpiresByType image/svg+xml "access plus 30 days"
ExpiresByType image/png "access plus 30 days"
ExpiresByType font/woff2 "access plus 30 days"
</IfModule>
