# Forzar HTTPS y WWW
RewriteEngine On

# Forzar HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

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

# Rutas amigables
RewriteRule ^propiedades/?$ propiedades.php [L]
RewriteRule ^propiedad/([0-9]+)/?$ detalles.php?id=$1 [L]
RewriteRule ^nosotros/?$ empresa.php [L]

# Opcional: Remover .php de URLs
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]