0

I have downloaded my site to a production environment. I have set up both the live site and the production site to use the same DB. When i login to the admin panel i get redirected to the live site. I know that wordpress stores URLs in the DB so i want to modify (hard code) my production site not to redirect anywhere.

Where and how?

Edit: I found the solution to this particular problem here http://www.davidpaulellenwood.com/expression/267/

But when one problem was tackled two new ones appeared and as discussed below, it's not worth it.

5
  • 1
    Honestly, you should not be using the same database for development and production. You should sync the live database to your dev copy so you maintain the most current information. What happens if your new code wipes out all of your live content? Seems like a nightmare.
    – MetalFrog
    May 29, 2012 at 15:11
  • You probably should set up a sandbox: codex.wordpress.org/Test_Driving_WordPress
    – Ryan B
    May 29, 2012 at 15:15
  • @MetalFrog I'd be willing to take that chance :(
    – Johan B
    May 29, 2012 at 15:29
  • @RyanB Yea, kinda limiting though
    – Johan B
    May 29, 2012 at 15:31
  • @JohanB how so?
    – Ryan B
    May 30, 2012 at 13:22

3 Answers 3

0

I think getting the site to redirect to the proper location on login would only be the beginning of your issues with this setup.

What would happen when you want to use any WordPress function to retrieve the site url? You would possibly have to re-write those functions as well, so that they return the production url instead of the url from the database.

If your production site is on your local machine you might try editing your HOSTS file so that your local machine thinks that its the real server. When you are finished working on your local machine you could then switch your hosts file back to normal to see the real live site again.

Check this URL http://wpmututorials.com/how-to/using-a-hosts-file/ for more info on using a hosts file.

2
  • I'm marking your answer as the solution. I got the login problem solved and as you said that was just the beginning so i'm leaving this approach.
    – Johan B
    May 30, 2012 at 9:00
  • davidpaulellenwood.com/expression/267 This was the post that helped me out
    – Johan B
    May 30, 2012 at 9:08
0

This is a REALLY, REALLY bad idea.

I don't want to tell you how to do it but some messing around with the site_url filter could possibly achieve what you want, but I really think you shouldn't try.

2
  • Please do not use answers for discussion. You will be able to leave comments when you gain some reputation on site.
    – Rarst
    May 29, 2012 at 15:50
  • It's very good idea. you can really test that everything will work if you publish your changes to public.
    – Tommixoft
    May 29, 2012 at 16:41
0

In addition to what @Matt Elliott said.

It's not just the DB you need to worry about, .htaccess works with wordpress to craft your permalink structure, this all begins from the root of the site and works with the Apache to formulate the correct front-end URL's based on URL parameters.

If you had some apache chops you might be able to tackle this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.