# Set custom webroots for your WordPress sites with Kinsta API

**URL:** https://community.kinsta.com/t/set-custom-webroots-for-your-wordpress-sites-with-kinsta-api/5033
**Category:** News and Announcements
**Created:** [April 29, 2025, 4:32pm UTC](https://community.kinsta.com/t/set-custom-webroots-for-your-wordpress-sites-with-kinsta-api/5033 "2025-04-29T16:32:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jeff](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/jeff/32/16_2.png) [@jeff](https://community.kinsta.com/u/jeff)
#### Post date: [April 29, 2025, 4:32pm UTC](https://community.kinsta.com/t/set-custom-webroots-for-your-wordpress-sites-with-kinsta-api/5033/1 "2025-04-29T16:32:18Z")

</div>

You can now set custom webroots for your WordPress sites at Kinsta using our public [API](https://kinsta.com/docs/kinsta-api/). This gives developers and agencies greater flexibility when managing deployments, version control, or customized site structures, without needing to contact [support](https://kinsta.com/kinsta-support/).

Previously, if you wanted to change a site’s webroot (for example, to support structures like [Bedrock](https://roots.io/bedrock/), where the public-facing folder is `/public/web`), you had to open a support ticket. Now, you can handle it programmatically, saving time for teams managing multiple environments or complex workflows.

### Info

This feature is currently available [via API only](https://api-docs.kinsta.com/tag/WordPress-Site-Environments#operation/changeEnvironmentWebRootSubfolder). A [MyKinsta](https://kinsta.com/mykinsta/) UI option may be added in the future based on user demand.

## How to change your WordPress site’s webroot

To change a site’s webroot, send a `POST` request to the Kinsta API’s `/change-webroot-subfolder` endpoint for a specific environment.

Here’s an example `POST` request:

```
curl -i -X POST \
  'https://api.kinsta.com/v2/sites/environments/{env_id}/change-webroot-subfolder' \
  -H 'Authorization: Bearer ' \
  -H 'Content-Type: application/json' \
  -d '{
    "web_root_subfolder": "your_subfolder_name",
    "clear_all_cache": true,
    "refresh_plugins_and_themes": true
  }'
```

In this request:

- `env_id`&nbsp;is the ID of the WordPress environment you want to update.
- `web_root_subfolder`&nbsp;sets the new subfolder you want to use as the webroot (for example, `release_v2`&nbsp;or `web`).
- `clear_all_cache`&nbsp;(optional) determines whether the site’s cache should be cleared during the change. Defaults to `true`.
- `refresh_plugins_and_themes`&nbsp;(optional) refreshes plugin and theme files to avoid conflicts after switching. Defaults to `true`.

Once you send the request, Kinsta updates the server configuration to point to the new subfolder. Additionally, it can clear the cache and refresh plugin and theme files if you have those options enabled.

After the process completes, the updated webroot path appears in your MyKinsta **Environment details** , as shown below.

 ![Updated webroot path displayed in the Environment details](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/d/db0034cc03605727bd0abda264a7bf687dd1c7eb.png)Updated webroot path displayed in the Environment details.
### Important

Before sending the API request, make sure the new subfolder already exists inside the site’s `public` directory and contains an `index.php` or `index.html` file. This helps avoid downtime or site errors. We also recommend testing the webroot change in a [staging environment](https://kinsta.com/docs/wordpress-hosting/staging-environment/) first, especially for production sites.

## WordPress management that fits your workflow

With the [Kinsta API](https://api-docs.kinsta.com/), you can do more than just set a custom webroot. Automate updates across multiple sites, integrate webroot changes into your deployment process, or even build tools like [Slackbots](https://kinsta.com/blog/create-slackbot-site-management/) to manage your environments on the fly.

It’s all about giving you more control — and making it easier to run WordPress sites the way you want.

Not a Kinsta customer yet? Check out our [hosting plans](https://kinsta.com/pricing/) to see what’s possible.

The post [Set custom webroots for your WordPress sites with Kinsta API](https://kinsta.com/changelog/custom-webroot/) appeared first on [Kinsta®](https://kinsta.com).

* * *
This is a companion discussion topic for the original entry at [https://kinsta.com/changelog/custom-webroot/](https://kinsta.com/changelog/custom-webroot/)
