Built a site locally on Wordpress - how do I trans

2019-09-06 00:17发布

I built a site for my friend locally on my computer using WAMP and downloading Wordpress. My friend already has his domain and web host on GoDaddy. Once I'm all finished, how do I go about transferring everything to his web host? Do I have to manually create a database on GoDaddy that's exactly like the one locally? Or is there a way to "upload" a MySQL database onto the web host? Also, does anything change in regards to the path of the files and the path of the database columns?

Please let me know everything I have to do as this is my first time doing this.

3条回答
小情绪 Triste *
2楼-- · 2019-09-06 00:55

If you want detailed instruction please follow this.

1, Upload all contents except your theme to new server
2, Import database from your local host.
2, Create a database on godaddy server.
It is very hard to export the database to godaddy server sometimes. If you stuck with exporting DB,
try this - Upload your localhost DB to _db_backups folder on godaddy server via FTP.
Once done, go to godaddy -> Launch hosting -> database -> my sql
On the popup, click on backup under details menu of your new DB. Select the uploaded DB from the popup list. The DB should be exported to new server within minutes.
Once DB exported, go to phpmyadmin. After log in, select your DB and click on sql on top menu.

paste below code to SQL window.

UPDATE wp_options SET option_value = replace(option_value, 'http://localhost/sitename', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

click on go button.

again go to SQL and paste below code

UPDATE wp_posts SET guid = replace(guid, 'http://localhost/sitename','http://www.new-domain.com');

click on go button.

Once again go to sql and paste below code

UPDATE wp_posts SET post_content = replace(post_content, 'http://localhost/sitename', 'http://www.new-domain.com');

"Note: change your localhost address and new domain address from above codes."

Now the site URL and post URL's should changed to new address.

Now get a search replace tool (I am using windows grep for this - http://www.wingrep.com/ )
Search and replace every instance of localhost address with new domain within your theme. After that upload the theme to new server.
Almost done.
Try to login with new server address. You should be able to login.
One final step.
Go to WordPress admin and install the plugin search and replace (http://wordpress.org/plugins/search-and-replace/) do a final search for localhost address, if found replace with new domain. After replacing you can safely delete this plugin.
You're done!
Don't forget to change DB details on wp-config.php as Leo T Abraham said.

查看更多
走好不送
3楼-- · 2019-09-06 01:00

Create a new database on godaddy - setting the username and password for the database.

Download wordpress.

Open the file 'wp-config-sample.php' and fill out all the information that you just set in godaddy.

Save the file as wp-config.php.

Upload the entire wordpress folder to the server.

and then upload the theme you made in the themes folder.

查看更多
Viruses.
4楼-- · 2019-09-06 01:18

There is a plugin named wp migrate db. Install that plugin and you can find that plugin under the tools menu. By using that plugin you can migrate the db for your new webhost.

Once you get your db using that plugin, simply create a database and import the migrtaed db. Then upload all your files as zip and extract at the webhost location.

Then only thing you need to do is, change the dbusername, password, database and host in the file wp-config in the root folder.

If you are using this method, there is no need to install wordpress again like you did in your localhost and you will get the entire contents as well.

查看更多
登录 后发表回答