Hate for my first post to a community to be a “plea for help”, as I love to help others…however, I’m in dire need of assistance!
After searching through the forums and trying various “fixes”, my issue persists: my local site is redirecting to the live site after pressing “view admin” or “view live site.”
I’ve done the following:
- replaced the site URL in database
- ran a find / replace in the site SSH
- disabled all plugins
- stopped / restarted the site
Still no luck.
I am confusion.
I take it this is a copy of the site from a live environment, there may be a few things lying around.
Have you checked if there is anything in a lurking .htaccess file?
If there isn’t one and you’re using NGNIX, if you’ve copied over the database there may be some cached data stored. A simple trick in the back end is to save the permalink structure twice.
While logged in to your local site via SSH you should be able to run the following WP CLI command -
wp rewrite structure '/%year%/%monthnum%/%postname%/'
You can replace ‘/%year%/%monthnum%/%postname%/’ with your own permalink structure found in the live site
Run the above command twice, then the following command.
wp cache flush
Hopefully that’ll solve your problem.
Let me know how you get on
This helped greatly, thank you very much!
Hope you had an awesome Thanksgiving.
Great to hear
We don’t celebrate thanksgiving over here in the UK, every weekend is an excuse for a roast here! I hope you had a great one with family!
Hi Phil, Aaron,
I have the same issue with my local site diverting to my live site for the “view site” and the “admin” takes me to my live site wordpress login?
I am new to WordPress and Local by Flywheel, I’m not a web designer and am not totally familiar with the SSH!
Can you give me “idiot proof” instructions on what to check and how to rectify the issue?
I really appreciate any assistance you can provide.
Thanks in advance