# =====================================================================
#  MACSMARIN — bascan.com.tr
# =====================================================================

Options -Indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
RewriteEngine On

# ---- HTTPS ----
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.bascan.com.tr/$1 [R=301,L]

# ---- apex -> www ----
RewriteCond %{HTTP_HOST} ^bascan\.com\.tr$ [NC]
RewriteRule ^(.*)$ https://www.bascan.com.tr/$1 [R=301,L]

# ---- ESKİ WORDPRESS ADRESLERİ (SEO için 301) ----
RewriteRule ^new/?$                                    /                            [R=301,L]
RewriteRule ^new/(.*)$                                 /$1                          [R=301,L]
RewriteRule ^mutfak-tezgahi-uygulamalari/?$            /uygulamalarimiz/mutfak-tezgahi      [R=301,L]
RewriteRule ^banyo-tezgahi-uygulamalari/?$             /uygulamalarimiz/banyo-tezgahi       [R=301,L]
RewriteRule ^kafe-bar-banko/?$                         /uygulamalarimiz/kafe-bar-banko      [R=301,L]
RewriteRule ^teknelere-yatlara-ozel-tezgah-tasarimlari/?$ /uygulamalarimiz/tekne-yat-tezgahlari [R=301,L]
RewriteRule ^cnc-islemeli-urunler/?$                   /uygulamalarimiz/cnc-islemeli-urunler [R=301,L]
RewriteRule ^kolon-kaplamalari/?$                      /uygulamalarimiz/kolon-kaplamalari   [R=301,L]

# ---- sondaki eğik çizgiyi kaldır (/sayfa/ -> /sayfa) ----
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/+$
RewriteRule ^(.+?)/+$ /$1 [R=301,L]

# ---- gerçek dosya/klasör ise dokunma ----
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# ---- geri kalan her şey ön denetleyiciye ----
RewriteRule ^ index.php [L]
</IfModule>

# ---- gizli klasörleri kapat ----
<FilesMatch "^\.">
  Require all denied
</FilesMatch>
RedirectMatch 404 ^/(inc|data|pages|_mesajlar)/

# ---- sıkıştırma ----
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml
  AddOutputFilterByType DEFLATE application/javascript application/x-javascript
  AddOutputFilterByType DEFLATE application/json application/xml image/svg+xml
</IfModule>

# ---- önbellek ----
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpeg             "access plus 1 year"
  ExpiresByType image/png              "access plus 1 year"
  ExpiresByType image/webp             "access plus 1 year"
  ExpiresByType image/svg+xml          "access plus 1 year"
  ExpiresByType application/pdf        "access plus 1 month"
  ExpiresByType text/css               "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
</IfModule>

# ---- güvenlik başlıkları ----
<IfModule mod_headers.c>
  Header set X-Content-Type-Options "nosniff"
  Header set Referrer-Policy "strict-origin-when-cross-origin"
  Header set X-Frame-Options "SAMEORIGIN"
</IfModule>

# ---- PHP sürümü (cPanel ea-php82) ----
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php82 .php .php8 .phtml
</IfModule>
