Change domain in WordPress

Context:

I deployed a wordpress website in AliYun web hosting before doing domain resolution and site registration, so website works on temporary domain which is provided by AliYun. The problem is coming, after registered website and resolved my domain to given IP successfully, I can access webisite by using my domain, but all other pages including sub pages, css files are not working. I found temporary domain is still working, those pages will be redirected to url prefixed with temporary domain.

Best Solution:

Go to WordPress admin page, Click settings-> General to reset url, this is easiest way to figure it.

Screen Shot 2016-08-30 at 10.48.57

Screen Shot 2016-08-30 at 10.46.03

The reason why I introduce other two methods to change url is that I typed wrong domain, it caused I can not open website even admin page, I can not change it right back.

Hard Solution:

Go to WordPress root folder using FileZilla or some other FTP tools.
Open wp-config.php, add following two lines to it, save it back.

define('WP_HOME','http://kingscow.com');
define('WP_SITEURL','http://kingscow.com');

Screen Shot 2016-08-30 at 10.44.08

As official said this is not best solution as domain will not be changable, as shown below.
Screen Shot 2016-08-30 at 10.40.41

Soft Solution:

Another way to change url while not fossilizing url is adding two lines to theme’s functions.php file, which is located at wp-content/themes//. If functions.php file does not exist, create one with that two lines only.
Screen Shot 2016-08-30 at 10.43.15
Refreshing pages until new domain works
**important** Remove that two lines from functions.php file, because it is not necessary right there.

Reference: https://codex.wordpress.org/Changing_The_Site_URL

Change domain in WordPress