---
id: TASK-51.2
title: 'Phase 1: Convert standalone domain rewrite to 301 redirects'
status: Done
assignee: []
created_date: '2026-02-25 07:47'
labels:
  - infrastructure
  - domains
  - migration
dependencies:
  - TASK-51.1
parent_task_id: TASK-51
priority: high
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Change server/index.ts standalone domain handling from silent rewrite to 301 redirect for HTML page loads. Keep API/WS rewriting so running apps don't break. Traefik labels stay — domains must still route to the container to serve the 301.

Target: server/index.ts lines 482-521. Redirect HTML page loads, continue proxying /api/* and /ws/* requests. keepStandalone domains unaffected.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 rmaps.online/some-room returns 301 to rspace.online/demo/maps/some-room
- [x] #2 rbooks.online/ returns 301 to rspace.online/demo/books
- [x] #3 API and WebSocket requests still proxied without redirect
- [x] #4 keepStandalone domains unaffected
<!-- AC:END -->

## Implementation Notes

301 redirect logic fully implemented in server/index.ts lines 2028-2098. domainToModule map built from mod.standaloneDomain, proper 301 Response.redirect issued, API/WS paths excluded. Traefik labels route all 20 standalone domains.
