# Nginx routing for Product Updates

Apache uses [`.htaccess`](../../../.htaccess) rules for `/produkt-updates/*`. On Nginx, replicate the same behavior.

## Required behavior

1. **`/produkt-updates/bilder/{file}`** must route to `v2/pages/produkt-updates-bilder.php` with the filename passed as `f` (see `.htaccess` `RewriteRule` for exact pattern).
2. **`/produkt-updates/media/{file}`** → **301** to `/produkt-updates/bilder/{file}` (retired prefix).
3. **`/wp-content/uploads/produkt-updates/{image}`** → **301** to `/produkt-updates/bilder/{image}` (legacy filesystem URL).
4. Month slugs and post slugs under `/produkt-updates/...` must **not** capture `/produkt-updates/bilder/` (bilder rules must come first).

## Example (adjust `root` / PHP handler to your stack)

```nginx
# Before generic /produkt-updates/ location — images first
location ~* ^/produkt-updates/bilder/([^/]+)$ {
    rewrite ^ /v2/pages/produkt-updates-bilder.php?f=$1 break;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root/v2/pages/produkt-updates-bilder.php;
    fastcgi_pass php;
}

location ~* ^/produkt-updates/media/(.+)$ {
    return 301 /produkt-updates/bilder/$1;
}

location ~* ^/wp-content/uploads/produkt-updates/(.+\.(webp|jpe?g|png|gif))$ {
    return 301 /produkt-updates/bilder/$1;
}
```

Use your project’s `fastcgi_pass` / `snippets/fastcgi-php.conf` conventions. Verify with `curl -I` on a known image URL.
