cache not purging

so i have a website on my apache2 server and recently i added a script like this one:

if (window.location.hostname === 'subdomain.example.com') {
window.location.replace('https://newdomain.com'/);
}

so i changed the domain inside window.location.replace, but it still goes to the old domain. i purged cloudflare cache many times, but it stays the same. even when i remove the script, it keeps redirecting. i enabled development mode, did custom cache purge etc, all, but it keeps redirecting to the old domain. also its not a local cache issue, as i tried with many browsers and ips.
Was this page helpful?