
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThe rewrite rule you've got is actually correct for a basic SPA setup, but there's a key detail: Vercel automatically serves static files before applying rewrites. So the issue likely isn't the rewrite rule itself—it's probably something else in your configuration.
Here's what you need for a standalone Sanity Studio deployment to Vercel:
{
"rewrites": [
{ "source": "/(.*)", "destination": "/index.html" }
]
}But wait—if this isn't working, here's what's likely wrong:
Make sure your vercel.json specifies where your built Studio files are. Sanity Studio builds to dist/ by default:
{
"buildCommand": "npm run build",
"outputDirectory": "dist",
"rewrites": [
{ "source": "/(.*)", "destination": "/index.html" }
]
}/studio)If your Studio lives at a route like /studio instead of the root, you need to:
a) Configure the basePath in your Sanity config:
// sanity.config.js
export default defineConfig({
basePath: '/studio',
// ... rest of config
})b) Update your rewrite to match:
{
"rewrites": [
{ "source": "/studio/(.*)", "destination": "/studio/index.html" }
]
}If you're embedding Studio in a Next.js app, you don't need rewrites at all—Next.js handles client-side routing automatically. The rewrite rule is only for standalone Studio deployments as SPAs.
Check your Vercel build logs to confirm that dist/index.html actually exists after the build runs. Run sanity build locally and verify the output.
Vercel checks for static files first, then applies rewrites. So your rewrite won't break CSS/JS files—those will be served directly. The rewrite only kicks in for paths that don't match actual files, which is exactly what you want for client-side routing in a single-page application.
If you're still stuck, double-check that your CORS origins are configured correctly in sanity.io/manage for both your Vercel deployment URL and localhost (for development). Also verify that your Vercel integration is set up properly if you're using visual editing features.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store