# HTML Path Rewriting Example
This document demonstrates how HTML path rewriting works when serving sites via the `/s/:identifier/:site/*` route.
## Problem
When you create a static site with absolute paths like `/style.css` or `/images/logo.png`, these paths work fine when served from the root domain. However, when served from a subdirectory like `/s/alice.bsky.social/mysite/`, these absolute paths break because they resolve to the server root instead of the site root.
## Solution
The hosting service automatically rewrites absolute paths in HTML files to work correctly in the subdirectory context.
## Example
**Original HTML file (index.html):**
```html
My Site
Welcome
```
**When accessed via `/s/alice.bsky.social/mysite/`, the HTML is rewritten to:**
```html
My Site
Welcome
```
## What's Preserved
Notice that:
- ✅ Absolute paths are rewritten: `/style.css` → `/s/alice.bsky.social/mysite/style.css`
- ✅ External URLs are preserved: `https://example.com` stays the same
- ✅ Anchors are preserved: `#top` stays the same
- ✅ The rewriting is safe and won't break your site
## Supported Attributes
The rewriter handles these HTML attributes:
- `src` - images, scripts, iframes, videos, audio
- `href` - links, stylesheets
- `action` - forms
- `data` - objects
- `poster` - video posters
- `srcset` - responsive images
## Testing Your Site
To test if your site works with path rewriting:
1. Upload your site to your PDS as a `place.wisp.fs` record
2. Access it via: `https://hosting.wisp.place/s/YOUR_HANDLE/SITE_NAME/`
3. Check that all resources load correctly
If you're using relative paths already (like `./style.css` or `../images/logo.png`), they'll work without any rewriting.