How do I get my domain to show in the browser?

My site is

Life For Liberia

I have my own domain:

https://lifeforliberia.org.uk/

I have set http://lifeforliberia.org.uk as my primary domain.
If I type http://lifeforliberia.org.uk in a browser, it loads my netlify website ok,
BUT the browser address bar shows

life-for-liberia.netlify.app/en/

Is it possible to get the browser to display my domain, rather than netlify? i.e.

#//LifeForLiberia.org.uk/en/

Thanks.

Hi, @StephenJD. The redirection is happening in your client-side javascript and there should be possible to fix this by just making a new deploy without making any other changes. Just a new deploy alone should fix this.

You can make this new deploy without making any code changes by clicking the “Trigger deploy” button on the page below:

https://app.netlify.com/sites/life-for-liberia/deploys

You don’t need to clear the cache. You can use use the “Deploy site” option shown below:
image

Now, you may be wondering how this happened as you probably didn’t write any custom client-side javascript yourself.

The answer here has to do with the framework you are using. You didn’t share that information here and I don’t want to do that for you. (I don’t want to give out any information that you haven’t already shared first.) So, I’m going to be talking about the build command as just command --option $URL but that isn’t your real build command.

The key here is that both the build command example above (command --option $URL) and your real build command use the environment variable URL in the command.

This URL environment variable is one of the build environment variables created automatically at Netlify. You can find more information about it in our documentation here:

https://docs.netlify.com/configure-builds/environment-variables/#deploy-urls-and-metadata

Quoting that page:

URL: URL representing the main address to your site. It can be either a Netlify subdomain or your own custom domain if you set one; for example,

When your site was built, the framework used for the build hard-codes the URL variable into the site’s client-side javascript. The URL on the day of the build was https://life-for-liberia.netlify.app.

You had not yet added your custom domain to the site when the build occurred so the URL variable defaults to that (https://life-for-liberia.netlify.app).

You have now added a custom domain but the client-side javascript still redirect back to the value of the URL environment variable.

So, what is the fix? Well, now that you have added a custom domain the URL environment variable will change to https://lifeforliberia.org.uk. However, for this to be properly hard-coded into the client-side javascript a new build needs to occur.

To summarize this all, if you just trigger a new deploy in the web UI at Netlify using the button shown above, that alone should be all that is required to fix this.

However, if it does not or if there are other questions, please let us know.