Happy New Year To You All !

I have a php site and would like to upload the same site onto another domain name, while keeping the current site also in it's current domain name.

Does anyone know how I can upload the database - mysql - and duplicate the site ???

Thank you :)

New Girl.

Recommended Answers

All 4 Replies

Use mysqldump to create a backup of the database and use mysqlimport to read it into the new database.

As long as you didn't refer to the absolute URL in the code, all you should need to do is copy the database over.

If you want to use the same database, you can set the server in your MySQL connect statement to the other host. That's how I handle my test environment and test database.

FYI, if you are trying to have two different sites available to the public this is a bad idea as Google will hit you with a duplicate content penalty of some sort.

If you have 1 site and 2 domain names why not just add the other domain as a 'addon domain' to the server and you can access that 1 copy from both url's

If you want to copy the site to another server then generate a full back-up with mysql-grabs upload the mysql-dump and scripts at the neew server. the only thing you will need to then change/re-create will be the database name and user.

$db = mysql_connect("localhost", "USERNAME", "PASSWORD") or  Die("No connection establish to database: " . mysql_error());




mysql_select_db("DATABASENAME") or Die("DB Error !");

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.