<p>You can change the URL of your site under <strong>Settings → Sites → [Your Site]</strong>. The <strong>Base URL</strong> can either be hard-coded or based on an <a href="https://craftcms.com/docs/4.x/config/#setting-and-resolving-options" rel="nofollow noreferrer">environment variable</a> or <a href="https://craftcms.com/docs/4.x/config/#aliases" rel="nofollow noreferrer">alias</a>. Using an environment variable is recommended, since it allows you to use different URLs in local development and on your live site. In this case, you can change the URL in your <code>.env</code> file (or by setting environment values in your server environment).</p>

CC BY-SA 4.0
2024-01-05T16:02:05.397Z
My site has a primary and a secondary.  I changed the urls (they were in the env file).  The primary is working, but if I go to the secondary domain it shows redirects to the primary url and site.  Any reason it would do that?
rudtek
CC BY-SA 4.0
2024-01-05T16:15:23.590Z
@rudtek Craft doesn't redirect you by itself, if it can't find a site matching the current domain and/or path, it will fall back to rendering the primary site. Do you have any `{% redirect %}` tags in your templates to redirect between sites? Or any custom modules to redirect based on the path/domain? Might also be an issue with your server configuration. Maybe post this as a new question with the contents of your `.env` file and screenshots of your website configuration.
MoritzLost
CC BY-SA 4.0
2024-01-05T17:54:26.353Z
okay I'll do that thanks..which website configuration...I'm very new to Craft.
rudtek
CC BY-SA 4.0
2024-01-06T14:55:15.683Z
@rudtek Your settings for both websites you created under **Settings -> Websites**!
MoritzLost
CC BY-SA 4.0
2024-01-05T08:27:55.980Z
2024-01-05T08:27:55.980Z
MoritzLost
<p>How do I tell craft to change to the new URL?</p>

<migration><siteurl>
I created a demo site and now want to set live url. How do I do that?
# I created a demo site and now want to set live url. How do I do that?

(Asked by: username_0 on 2024-01-05)

How do I tell craft to change to the new URL?

**Tags:** migration, siteurl


---

## 1 answers

### Answer by username_1 on 2024-01-05. Score: 3 | Accepted answer

You can change the URL of your site under **Settings → Sites → [Your Site]**. The **Base URL** can either be hard-coded or based on an [environment variable](https://craftcms.com/docs/4.x/config/#setting-and-resolving-options) or [alias](https://craftcms.com/docs/4.x/config/#aliases). Using an environment variable is recommended, since it allows you to use different URLs in local development and on your live site. In this case, you can change the URL in your `.env` file (or by setting environment values in your server environment).

> **Comments:**
> **username_0**: My site has a primary and a secondary.  I changed the urls (they were in the env file).  The primary is working, but if I go to the secondary domain it shows redirects to the primary url and site.  Any reason it would do that?  
> **username_1**: @username_0 Craft doesn't redirect you by itself, if it can't find a site matching the current domain and/or path, it will fall back to rendering the primary site. Do you have any `{% redirect %}` tags in your templates to redirect between sites? Or any custom modules to redirect based on the path/domain? Might also be an issue with your server configuration. Maybe post this as a new question with the contents of your `.env` file and screenshots of your website configuration.  
> **username_0**: okay I'll do that thanks..which website configuration...I'm very new to Craft.  
> **username_1**: @username_0 Your settings for both websites you created under **Settings -> Websites**!  

---

