# Change site host url

**URL:** https://community.kinsta.com/t/change-site-host-url/2274
**Category:** Application Support
**Created:** [May 23, 2023, 7:22pm UTC](https://community.kinsta.com/t/change-site-host-url/2274 "2023-05-23T19:22:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![balbert](https://avatars.discourse-cdn.com/v4/letter/b/3e96dc/32.png) [@balbert](https://community.kinsta.com/u/balbert)
#### Post date: [May 23, 2023, 7:22pm UTC](https://community.kinsta.com/t/change-site-host-url/2274/1 "2023-05-23T19:22:02Z")

</div>

Is it possible to change/update the site host value after a site is created?

When creating my first site, i setup mydomain.local, but i want to change it to [local.mydomain.com](http://local.mydomain.com). I’ve added that to my NGINX config via the NGINX Editor and updated my DB site and home urls as well as manually added that to my hosts file and the site will respond to that, but I think it is causing other issues.

do i have to basically export everything and create a new site with that name and then reimport everything?

Also it doesn’t seem like you can create a site with [subdomain.domain.com](http://subdomain.domain.com) and that only domain.tld can be done.?

Thanks  
Bob

Mac OS 12.6.5  
DevKinsta Version 2.10.0 (2.10.0.6571)  
Not a Kinsta hosting customer

---

<div class="post-metadata">

### Author: ![Alessandro](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/alessandro/32/2310_2.png) [@Alessandro](https://community.kinsta.com/u/Alessandro)
#### Post date: [May 24, 2023, 10:37am UTC](https://community.kinsta.com/t/change-site-host-url/2274/2 "2023-05-24T10:37:37Z")

</div>

Hello @balbert and welcome to DevKinsta Community!  
You won’t need to do this change manually, you can set a subdomain as primary domain directly in DevKinsta.

Create a new site and called it subdomain, this will create a new site having subdomain.local as primary domain.  
Once that’s done, open the site page in DevKinsta and scroll down until you see the option called Top level domain. There you will be able to edit the site host by writing .domain.com (or whatever root domain you would like to use). This will then allow to have your host changed in [subdomain.domain.com](http://subdomain.domain.com), all the needed changes in Nginx and database will be handled by DevKinsta.

 ![Screenshot 2023-05-24 at 11.36.16](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/c/cc97cb9dfdb594a53e3cd44ea2db25ac9122204b.png)

Regards,  
Alessandro

---

<div class="post-metadata">

### Author: ![colby.l](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/colby.l/32/2114_2.png) [@colby.l](https://community.kinsta.com/u/colby.l)
#### Post date: [May 26, 2023, 3:03pm UTC](https://community.kinsta.com/t/change-site-host-url/2274/3 "2023-05-26T15:03:55Z")

</div>

Hello!

Thanks so much for the guidance on renaming the TLD to `.domain.com` and relying on site name for the subdomain. It appears to work great! However, it seems like re-syncing your local site from Kinsta will break the config and changes the TLD back (in my case, it reverted it to `.com` - presumably to match the remote URL?).

When I try to fix this by re-attempting the rename process as mentioned, it goes through the process of updating root certificates & my hosts file… but it seems to fail silently? The domain TLD never gets updated and stays as `.com`, and once I restart Docker Engine and DevKinsta, it fails to start. DevKinsta gives the error DK0005, and the Nginx container in Docker is stuck in a loop, restarting after outputting the following log (I’ve changed the real domain to `example.com`).

```auto
2023-05-26 08:57:02 2023/05/26 14:57:02 [emerg] 1#1: cannot load certificate "/www/kinsta/ssl/local.example.com.crt": BIO_new_file() failed (SSL: error:80000002:system library::No such file or directory:calling fopen(/www/kinsta/ssl/local.example.com.crt, r) error:10000080:BIO routines::no such file)
2023-05-26 08:57:02 nginx: [emerg] cannot load certificate "/www/kinsta/ssl/local.example.com.crt": BIO_new_file() failed (SSL: error:80000002:system library::No such file or directory:calling fopen(/www/kinsta/ssl/local.example.com.crt, r) error:10000080:BIO routines::no such file)

```

My assumption is that this is a bug with the sync, but wanted to raise it and see if y’all were aware and knew of any workarounds or fixes.

Thanks!  
Colby

macOS 13.3.1(a)  
DevKinsta 2.10.0.6571

---

<div class="post-metadata">

### Author: ![Alessandro](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/alessandro/32/2310_2.png) [@Alessandro](https://community.kinsta.com/u/Alessandro)
#### Post date: [May 26, 2023, 3:27pm UTC](https://community.kinsta.com/t/change-site-host-url/2274/4 "2023-05-26T15:27:29Z")

</div>

Hey @colby.l 👋 welcome to DevKinsta’s Community!

Regarding the issue with the sync, can you please verify if inside the wp-config.php you had a `define` that was forcing the site url/home?

About the SSL certificate, if you open your finder and move to ~/Devkinsta you should see a folder called ssl. Can you see a certificate (.crt file) named as the old domain? If so, if you do a preview of it (just select it and press the spacebar to use QuickLook), is the Common Name field showing the old or new domain?

Regards,  
Alessandro

---

<div class="post-metadata">

### Author: ![colby.l](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/colby.l/32/2114_2.png) [@colby.l](https://community.kinsta.com/u/colby.l)
#### Post date: [May 26, 2023, 3:35pm UTC](https://community.kinsta.com/t/change-site-host-url/2274/5 "2023-05-26T15:35:51Z")

</div>

Just double-checked and we do not define a `WP_HOME` or `WP_SITEURL` within our `wp-config.php`. And the `ssl` folder appears to be empty…

---

<div class="post-metadata">

### Author: ![ZachE](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/zache/32/1683_2.png) [@ZachE](https://community.kinsta.com/u/ZachE)
#### Post date: [May 26, 2023, 11:53pm UTC](https://community.kinsta.com/t/change-site-host-url/2274/6 "2023-05-26T23:53:57Z")

</div>

Hey @colby.l

Can we try adjusting the settings of the Site in DevKinsta by deactivating HTTPS, changing the TLD to another domain, changing it back to the real domain, then reactivating HTTPS? I _think_ hopefully that should reset the NGINX configuration, and apply the certificate to the right hostname, and should then appear in the ssl folder.

Let us know!

Best regards,  
Zach
