Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm not sure why but when i just want to create a copy of a site that i'm working on in MAMP, that say i just downloaded from the web. I just copy the same wp-config file from another local version that i've been working on.

But when i try to go to that new htdocs directory (which is essentially just a copy of the old one) it doesn't recognize the db.

Can anyone see why this might be a problem or possibly warn me of other reasons why this would be a fail?

Here is my process, I'm using a hosted version because I have another team working on it. I prefer to work locally so what i do is

  1. download the files and images through a plugin

  2. Create a new server in MAMP (titled Site2)

  3. copy the contents of the backup zip (that i just downloaded from my server) into my new local server (title Site2)

  4. Update the config file to be exactly like the current version that I have on MAMP (Site1) and when I go to that site I'm able to get onto the correct first page but then when I go into other pages I re-direct to the Site1 interior pages

Could this be because I'm using the exact same wp-config file as Site1? Would this mean that with every copy or version of the site that I work on that I should created a new unique WP-config file? I realize that if I had worked with Git from the beginning this would be more manageable but I'm already in the site process

Updated to illustrate my point:

Currently in my wp-config file i have this:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wp_site1');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', 'root');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
share|improve this question
1  
Exactly what it the error/problem/issue? Are there debugging messages? –  s_ha_dum Oct 20 '13 at 22:06
    
@s_ha_dum Here is my process. I'm using a hosted version because i have another team working on it. I prefer to work locally so what i do is 1) download the files and images through a plugin 2) Create a new server in MAMP (titled Site2) 3) copy the contents of the backup zip (that i just downloaded from my server) into my new local server (title Site2) 4) Update the config file to be exactly like the current version that i have on MAMP (Site1) and when i go to that site i'm able to get onto the correct first page but then when i go into other pages i re-direct to the Site1 interior pages –  MARS Oct 20 '13 at 22:45
    
@s_ha_dum Could this be because I'm using the exact same wp-config file as Site1? Would this mean that with every copy or version of the site that i work on that i should created a new unique WP-config file? I realize that if i had worked with Git from the beginning this would be more manageable but i'm already in the site process so while not too late to go back to Git i'm taking baby steps here. –  MARS Oct 20 '13 at 22:46

1 Answer 1

You will need a different database for each site, or at least a different database prefix. In either case, you're wp-config.php file will be different for each site. I don't see how that copying that file verbatum will work.

Based on this comment:

Update the config file to be exactly like the current version that i have on MAMP (Site1) and when i go to that site i'm able to get onto the correct first page but then when i go into other pages i re-direct to the Site1 interior pages

I am guessing that you have WP_SITEURL or WP_HOME defined in that wp-config.php file. That is why you are getting the strange redirect.

Alternately, if you are trying to share a database or use two sites with the same prefix, the value in the database is going to cause trouble. It can only be set to one site or the other.

share|improve this answer
    
That makes sense, thank you. Just to answer your comment about the WP_SITEURL or WP_HOME. I don't actually include those until i push the site live from my local production then i include those in addition to the proper database and admin user/pass. I included above what i generally use when working locally for you to see if that's correct or not. So basically when i come back from a live hosted version and want to use it again locally i go back to what i posted above. Is that a proper process? Thanks. –  MARS Oct 21 '13 at 1:13
    
And finally if i were to create another database locally, it would just be spinning up a new db in MyPHPAdmin and importing the SQL file that i just downloaded from the live site, would that be a correct process? –  MARS Oct 21 '13 at 1:16
    
You can move a database that way, yes, but you have to edit a couple of places as explained in the Codex entry for moving WordPress. –  s_ha_dum Oct 21 '13 at 1:19
    
I created a new db in phpMyAdmin and called it wp_site2 (for examples' sake) I then uploaded the SQL file that i downloaded from the live site. Creating and spinning up the server all worked fine. But when i launch the new site (ex: site2:8888) it takes me to its proper front page but when i navigate into interior pages it goes back to site1:8888 when showing the directory. I flushed the permalinks when i logged into the Admin panel at site2:8888/wp-admin so i don't know if this has some kind of affect, otherwise do you think it has something to do with the db? Thanks. –  MARS Oct 21 '13 at 1:24
    
You've got some bad configuration values. Review this carefully: codex.wordpress.org/… –  s_ha_dum Oct 21 '13 at 1:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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