  # CORS Headers - 모든 요청에 대해 CORS 헤더 추가
  <IfModule mod_headers.c>
      Header always set Access-Control-Allow-Origin "*"
      Header always set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
      Header always set Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With, Accept"
      Header always set Access-Control-Max-Age "3600"
  </IfModule>

  <IfModule mod_rewrite.c>
      RewriteEngine On

      # OPTIONS 요청 처리 (Preflight)
      RewriteCond %{REQUEST_METHOD} OPTIONS
      RewriteRule ^(.*)$ $1 [R=200,L]

      # 1. /writable/uploads/item/thumb/ 경로는 rewrite 안 함
      RewriteCond %{REQUEST_URI} ^/writable/uploads/item/thumb/
      RewriteRule ^ - [L]

      # 2. API 요청은 CodeIgniter index.php로
      RewriteCond %{REQUEST_URI} ^/api
      RewriteRule ^api/(.*)$ index.php/api/$1 [L]

      # 3. 관리자 API 요청
      RewriteCond %{REQUEST_URI} ^/admin/api
      RewriteRule ^admin/api/(.*)$ index.php/admin/api/$1 [L]

      # 4. Nuxt 정적 파일 (_nuxt, assets 등)
      RewriteCond %{REQUEST_FILENAME} -f
      RewriteRule ^ - [L]

      # 5. 나머지 모든 요청은 Nuxt 200.html로 (SPA fallback)
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^.*$ /200.html [L]
  </IfModule>