Support Forums

Netlify always redirect new netlify url to old deleted netlify url

I just deleted my old site and starting with a new site from the same github repository. After the deploy is finished, I try to open the new site link multiple times, but for some reason it always redirect to the old site link which of course cause an error because it does not exist anymore. Any help will be greatly appreciated.

Perhaps try in an incognito window or clear your cache?

I have tried it on my computer and phone, also multiple browsers and cleaning caches. Can you try to test it by opening the new link?

Na, doesn’t work for me either. Have you got a .netlify folder in your editor? If so, there’s a state.json file in there with the kind of code that appears in the browser’s error. This .netlify folder gets .gitignored when you push to github so perhaps you need to change the value in there to the old (or new?) code so that they match? Hope that makes sense. If that doesn’t work, I’m out of ideas sorry.

1 Like

Saying all that, the folder gets .gitignored so not sure why that would change anything in production…

@rizkyzhang Welcome to the Netlify community. Are you certain you don’t have a redirect instruction somewhere in your code, either in the netlify.toml file (as suggested by d000000m), or in a _redirect file, or in a meta refresh command, or ???

1 Like

Thank you so much for your help, I think I only have two solutions now, either start with a new github repository or rename the site to the old one.

1 Like

Thank you for replying me. I never write a redirect instruction inside netlify.toml file and I don’t even have a _redirect file yet. Is there other possible causes for this problem?

@rizkyzhang It still looks to be redirect, because it’s almost too simple to be anything else. Care to share the address of your repository?


Greetings :wave:t2:

Your new site link, https://gifted-almeida-352594.netlify.app/, when hit from CLI renders a very small bit of HTML that contains a meta refresh tag; effectively a redirect encoded in HTML. It also includes a canonical tag; so Netlify is clearly aware that this URL and the old URL are linked together somehow - I presume Netlify’s generating this response… but I’m not sure why. If you made a brand new Netlify Site that just happens to be linked to the same repository, it should’ve been isolated at that point :thinking:

$: http https://gifted-almeida-352594.netlify.app/
GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: gifted-almeida-352594.netlify.app
User-Agent: HTTPie/2.1.0

HTTP/1.1 200 OK
Age: 1
Cache-Control: public, max-age=0, must-revalidate
Connection: keep-alive
Content-Length: 322
Content-Type: text/html; charset=UTF-8
Date: Thu, 12 Nov 2020 15:57:50 GMT
Etag: "e667f15174f5c3109d6828a1fc791598-ssl"
Server: Netlify
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-NF-Request-ID: fd0d787e-ca0b-446b-837e-c03ca1c15b0a-5125442

<!doctype html><html><head><title>https://dazzling-ritchie-cd2795.netlify.app/en/</title><link rel=canonical href=https://dazzling-ritchie-cd2795.netlify.app/en/><meta name=robots content="noindex"><meta charset=utf-8><meta http-equiv=refresh content="0; url=https://dazzling-ritchie-cd2795.netlify.app/en/"></head></html>


1 Like

@jonsully I’m intrigued by the http terminal command. I’m not finding it on Homebrew and it’s not built into macOS. Where did you find it?

httpie is the best. I run it with -vF defaulted on.
It’s available on brew :slight_smile:

@jonsully Got it. Thanks.

Thank you for the insight. Yeah, I think it should be isolated, maybe some kind of bug? Very weird indeed, I will try to create a new Github repository and deploy it again to see if it still happens.

@rizkyzhang You might try searching the code in your repository to see if you can find this meta refresh. This doesn’t look to be a bug, it looks to be there because someone put it there.


It seems to be fixed right now, I found a “base_url” variable inside config.toml and assign it to empty string, might be the culprit. Thank you so much for the help everyone :slight_smile:

1 Like