# Local Redirecting to Live Site

**URL:** <https://community.localwp.com/t/local-redirecting-to-live-site/3938>\
**Category:** Support\
**Created:** [November 21, 2017, 9:40pm UTC](https://community.localwp.com/t/local-redirecting-to-live-site/3938 "2017-11-21T21:40:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaronmarquez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/aaronmarquez/32/2174_2.png) [@aaronmarquez](https://community.localwp.com/u/aaronmarquez)\
**Post date:** [November 21, 2017, 9:40pm UTC](https://community.localwp.com/t/local-redirecting-to-live-site/3938/1 "2017-11-21T21:40:49Z")

</div>

Hi there!

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.

---

<div class="post-metadata">

**Author:** ![Phiph](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Phiph](https://community.localwp.com/u/Phiph)\
**Post date:** [November 23, 2017, 3:51pm UTC](https://community.localwp.com/t/local-redirecting-to-live-site/3938/2 "2017-11-23T15:51:28Z")

</div>

Hey Aaron,

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 😄

Cheers,

Phill

---

<div class="post-metadata">

**Author:** ![aaronmarquez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/aaronmarquez/32/2174_2.png) [@aaronmarquez](https://community.localwp.com/u/aaronmarquez)\
**Post date:** [November 25, 2017, 2:05am UTC](https://community.localwp.com/t/local-redirecting-to-live-site/3938/3 "2017-11-25T02:05:37Z")

</div>

Hi Phill,

This helped greatly, thank you very much! 🙂

Hope you had an awesome Thanksgiving.

---

<div class="post-metadata">

**Author:** ![Phiph](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Phiph](https://community.localwp.com/u/Phiph)\
**Post date:** [December 6, 2017, 8:21pm UTC](https://community.localwp.com/t/local-redirecting-to-live-site/3938/4 "2017-12-06T20:21:24Z")

</div>

Hi Aaron,

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!

Thanks,

Phill

---

<div class="post-metadata">

**Author:** ![billyerskine](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/billyerskine/32/7713_2.png) [@billyerskine](https://community.localwp.com/u/billyerskine)\
**Post date:** [June 11, 2019, 3:57pm UTC](https://community.localwp.com/t/local-redirecting-to-live-site/3938/5 "2019-06-11T15:57:02Z")

</div>

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

Billy

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)\
**Post date:** [August 25, 2020, 6:33pm UTC](https://community.localwp.com/t/local-redirecting-to-live-site/3938/6 "2020-08-25T18:33:10Z")

</div>


