Cannot access local dev site

I have a few websites loaded on my local, dev kinsta and all work as they should.

However, I just pulled one from staging to begin working on some changes locally, and I cannot access the local domain.

From DevKinsta the ‘open site’ button, links to the staging site. I tested it in incognito as well, same thing. The local url keeps redirecting to staging.

Not sure what is causing this.

Hi @natasha_nightshift, thanks for reaching out!

What operating system are you using? We have a new DevKinsta version that will be released within the next week, but I know there is an issue with Windows databases not being updated correctly when you pull from Kinsta to DevKinsta.

Hello Kevin, I am on a macOS 12.3.1

Interesting, can you please private message your staging URL to me?

Thank you for sharing the URL!

So I don’t see any caching plugins on the site that would cause this.

Try checking wp-config.php on the DevKinsta site for the “” address and change it to the
“.local” version.

The only other thing I can think of is that for some reason the search and replace on the database did not occur. You can check the database within DevKinsta or you can just try running a search and replace on the Staging site BEFORE you try to pull the site to DevKinsta.

You would need to run a search and replace that looks something like this:
From: //
To: //mysite.local

If the site still redirects to staging after a new Pull, please DM your main.log file to me as well.

main.log (42.7 KB)
Here is my main.log file

1 Like

Oh that’s weird. There is a line that teslls you what the search and replace did:

[wpSearchAndReplace] Search and replace. Source: http://site.local, to: https://site.local

For some reason all it did was rewrite your local links from http to https.

Can you please try pulling just your Live site instead of the Staging? I’ll still bring this issue up with our developers but I’ll help find a temporary solution.

Actually, scratch that @natasha_nightshift. I see the error now:

[wpSearchAndReplace] Search and replace. Source: PHP Notice: Undefined index: HTTP_HOST

On the staging site, can you please comment out or remove the extra code that’s in there? It’s causing an error that I believe is behind this. It is the line that looks like this:

if ($_SERVER['HTTP_HOST'] == '') {
    $_SERVER['HTTP_HOST'] = "";

You will need to remove that before the Pull but you can add it back/edit it later.

Hi Kevin, I also had thought that code was causing the error, so I commented it out locally and it didn’t change anything.

I also just deleted my local site, and re-pulled, but from LIVE as you noted. I removed the code above, before pulling as well, and still, no change. Still points to staging. :frowning:

Can you please try removing the lines from Staging’s wp-config.php before you try Pulling? I still see them there on both Live and Staging. It has to be changed on the remote/Kinsta site instead of the local DK one.

Hi Kevin,
I did remove the code before I pulled from live, but as it did not work, so I reverted those changes and tossed them back on the live server.

Ah okay, that makes sense. If you do that for staging, can you leave it removed and share the new main.log after a fresh Pull? I’m just trying to narrow down the possible issues but getting rid of the errors/notices.

Hi Kevin,

  • I removed that code snippet from staging
  • I made a fresh pull from staging

View site button still links to staging. Attaching new log file for you.
main.log (227.0 KB)

Thanks Natasha,
So according to the logs [wpSearchAndReplace] occurred and correctly replaced the staging URL with the local one in the database.

Have you already tried opening the local URL Incognito or in a different browser? It could definitely be your browser still caching that redirect if it was a 301 redirect. If not, can you open the database manager and check the wp_options table to see if it’s still referencing the Staging site?

I think we’ve solved the issue with the database being incorrect, though.

Also, now that the site is in DevKinsta, you can also try renaming it. That would resolve a cached redirect if you change the URL/name

I keep getting an error when trying to rename.

And I also can’t cancel it.

Can you please share the current main.log with me?

main.log (371.2 KB)

1 Like

So this error is saying that the Docker container has been stopped:
Error in operation RENAME_SITE, step deleteOldSite: Error: (HTTP code 409) container stopped/paused

Does Docker show all the containers as started? I believe the issue is ‘devkinsta_nginx’

You might try stopping and starting it.

Thank you for sharing your main.log files. I’ll ask our devs to look over them as well.