# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

# Configurações adicionais
# Evitar o acesso a arquivos ocultos
<FilesMatch "^\.">
  Order allow,deny
  Deny from all
</FilesMatch>

# Desabilitar o acesso ao wp-config.php
<files wp-config.php>
  Order allow,deny
  Deny from all
</files>

# Proteção contra hotlinking de imagens
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?seusite\.com/ [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [F]

# Redirecionar www para sem www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]

# Definir o cache para arquivos estáticos
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType text/css "access plus 1 week"
  ExpiresByType application/javascript "access plus 1 week"
</IfModule>