# .htaccess
RewriteEngine On
RewriteBase /

# Remove .php extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]

# Redirect .php to clean URL
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R=301,L]

# API routes
RewriteRule ^api/v1/convert$ api/convert.php [NC,L]
RewriteRule ^api/v1/status$ api/status.php [NC,L]

# Custom error pages
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php

# Security
Options -Indexes
ServerSignature Off

# Caching
<FilesMatch "\.(jpg|jpeg|png|gif|js|css)$">
    Header set Cache-Control "max-age=2592000, public"
</FilesMatch>

# Compression
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
</IfModule>