I have a craft site that was in developement. the main site was linked just to an IP address the secondary site was linked to a url. Everything was working perfectly, I could see each site individually and make changes to both from the dashboard at the primary site. When we were ready to go live, I edited the .env file and changed the urls to the 2 new domains. Now when I try to load the primary site or dashboard, everything is fine, however when I try to load the content of the secondary site by visiting the secondary URL it loads the content of the primary URL but the actual url is correct and shows the secondary url.

So, going to https://example1.com loads content correctly.

Going to https://example2.comleaves https://example2.com in the URL bar but shows content of https://example1.com.

the only changes I made where here in the .env file.

APP_URL=ip address


everything at newexample1.com works fine.

Primary site:

enter image description here

Secondary Site

enter image description here

As an update it's not this way for everyone. Some people see both sites correctly but others don't. People who can't see it correctly have cleared caches, gone incognito, and tried different browsers.

  • 1
    Please post your website configuration (Settings -> Websites) for both sites. When you visit the secondary domain, are you redirected to site one (i.e. you see the primary domain in your browser) or does the URL bar still show the secondary domain, but Craft loads the primary site?
    – MoritzLost
    Commented Jan 6 at 14:57
  • @MoritzLost. I added the screenshots of the pages. I had settings "sites" not "websites" but maybe that's because I'm still on 3.9.6
    – rudtek
    Commented Jan 8 at 22:53
  • Hm, looks correct to me. Double check the server configuration (any redirects in a htaccess file, Apache or Nginx config?), and make sure to clear all server-side caches in Utilities -> Caches. Also, check again your templates to see if there are any redirects happening there.
    – MoritzLost
    Commented Jan 9 at 15:26
  • @MoritzLost. You're good! it was my .htacess file. Do you want to post as an answer? I needed to add a re-direct from my www to non.
    – rudtek
    Commented Jan 9 at 18:20
  • Ah, great 👍🏻 I've added an answer accordingly.
    – MoritzLost
    Commented Jan 10 at 8:52

1 Answer 1


Craft doesn't usually perform redirects in the frontend based on the domain. If the current domain matches the Base URL, Craft will load that site and attempt to display the correct route for that site and the requested path. If the domain doesn't match any defined sites, it will fall back to the default site.

Redirects can happen in multiple places:

  1. Your server config (for example, the Apache or Nginx site config or an .htaccess file in your web root).
  2. Any {% redirect %} tags in your templates.
  3. PHP code in custom modules or plugins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.