---
title: Can I redirect from a subdomain to a subpath?
description: Learn how to redirect from your subdomain to a subpath on Vercel with a vercel.json file or with Next.js
url: /kb/guide/can-i-redirect-from-a-subdomain-to-a-subpath
canonical_url: "https://vercel.com/kb/guide/can-i-redirect-from-a-subdomain-to-a-subpath"
published: 2025-11-03
last_updated: 2026-07-16
authors: Lee Robinson
related:
  - /docs/project-configuration
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---
<!-- docsgraph:related -->
## Related pages

> **For AI agents:** Follow these links to understand how this page connects to the rest of the Vercel ecosystem. For the full cross-link map (inbound, outbound, prerequisites, and semantic neighbors), see the .graph.md link below.

- [Configuration Redirects](https://vercel.com/docs/routing/redirects/configuration-redirects?from=related) — Learn how to define static redirects in your framework configuration or vercel.json with support for wildcards, pattern
- [Deploying & Redirecting Domains](https://vercel.com/docs/domains/working-with-domains/deploying-and-redirecting?from=related) — Learn how to deploy your domains and set up domain redirects with this guide.
- [Redirects](https://vercel.com/docs/routing/redirects?from=related) — Learn how to use redirects on Vercel to instruct Vercel's platform to redirect incoming requests to a new URL.
- [Manage Redirects at Scale](https://vercel.com/docs/routing/redirects/manage-redirects-at-scale?from=related) — Add, bulk upload, version, and roll back project-level redirects using the CLI.
- [Custom Subpaths](https://vercel.com/docs/platforms/multi-tenant-platforms/custom-subpaths?from=related) — Host platform content on custom subpaths of customer domains while maintaining a single Next.js application.
- [How do I perform Vercel redirects based on query strings?](https://vercel.com/kb/guide/how-do-i-perform-vercel-redirects-based-on-query-strings?from=related) — When using redirects with the \`vercel.json\` or \`next.config.js\` configuration file, your URL may contain query param
- [Can I use Vercel as a reverse proxy?](https://vercel.com/kb/guide/vercel-reverse-proxy-rewrites-external?from=related) — Learn how to use rewrites to proxy requests from Vercel to other deployments.
- [Does Vercel support permanent redirects?](https://vercel.com/kb/guide/does-vercel-support-permanent-redirects?from=related) — Information on Vercel's support for permanent redirects.
- [How can I increase the limit of redirects or use dynamic redirects on Vercel?](https://vercel.com/kb/guide/how-can-i-increase-the-limit-of-redirects-or-use-dynamic-redirects-on-vercel?from=related) — Instructions on how to use Serverless Functions to handle redirects on Vercel.
- [How can I serve multiple projects under a single domain?](https://vercel.com/kb/guide/how-can-i-serve-multiple-projects-under-a-single-domain?from=related) — Learn how to serve multiple Vercel projects from a single domain.

Full cross-link map for this page: [/kb/guide/can-i-redirect-from-a-subdomain-to-a-subpath.graph.md](/kb/guide/can-i-redirect-from-a-subdomain-to-a-subpath.graph.md)
<!-- /docsgraph:related -->


[Vercel](https://vercel.com/) (and [Next.js](https://nextjs.org/)) both offer the ability to add [Redirects](https://vercel.com/docs/project-configuration#project-configuration/redirects) and [Rewrites](https://vercel.com/docs/project-configuration#project-configuration/rewrites) to your application. This approach is commonly used for subpaths. For example, adding a redirect from `acme.com/old` to `acme.com/new`.

If you want to rewrite `app.acme.com` to `acme.com/app`, you'll need to configure a rewrite making use of the `has` field.

## Configuring a Rewrite with 'has' Field

1. Create a `next.config.js` file is using Next.js or a `vercel.json` file like below.
   
2. Push your changes and redeploy your application.
   

```javascript
rewrites() {
    return {
        beforeFiles: [
            // if the host is `app.acme.com`,
            // this rewrite will be applied
            {
                source: '/:path*',
                has: [
                    {
                        type: 'host',
                        value: 'app.acme.com',
                    },
                ],
                destination: '/app/:path*',
            },
        ]
    }
}
```
```javascript
{
  "rewrites": [
    {
      "source": "/:path*",
      "has": [
        {
          "type": "host",
          "value": "app.acme.com"
        }
      ],
      "destination": "/app/:path*"
    }
  ]
}
```

When a request is made to `app.acme.com`, then it will be rewritten to `acme.com/app`.