<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>local host to server migration | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/local-host-to-server-migration/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sun, 11 Dec 2022 04:46:36 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>How to move WordPress site to a new server or a new domain using SSH</title>
		<link>https://studentprojects.in/software-development/wordpress/wordpress-installation/how-to-move-wordpress-site-to-a-new-server-or-a-new-domain-using-ssh/</link>
					<comments>https://studentprojects.in/software-development/wordpress/wordpress-installation/how-to-move-wordpress-site-to-a-new-server-or-a-new-domain-using-ssh/#respond</comments>
		
		<dc:creator><![CDATA[Ranjith Kadamboor]]></dc:creator>
		<pubDate>Mon, 30 May 2022 13:41:37 +0000</pubDate>
				<category><![CDATA[WordPress Installation]]></category>
		<category><![CDATA[Move domain]]></category>
		<category><![CDATA[move wordpress]]></category>
		<category><![CDATA[Export database through SSH]]></category>
		<category><![CDATA[local host to server migration]]></category>
		<category><![CDATA[Migrate website suing SSH]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9333</guid>

					<description><![CDATA[<p>Here is a Step by step procedure&#160;to move a WordPress site from&#160;one server to another&#160;server or&#160;from localhost to server. You can also move the complete website setup from&#160;one domain name to another. Here I will explain how to move the website using SSH. If you do not have SSH access then you can try using</p>
<p>The post <a href="https://studentprojects.in/software-development/wordpress/wordpress-installation/how-to-move-wordpress-site-to-a-new-server-or-a-new-domain-using-ssh/">How to move WordPress site to a new server or a new domain using SSH</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Here is a <strong>Step by step procedure</strong>&nbsp;to move a WordPress site from&nbsp;<strong>one server to another</strong>&nbsp;<strong>server</strong> or<strong>&nbsp;from localhost to server</strong>. You can also move the complete website setup from&nbsp;<strong>one domain name to another</strong>.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="960" height="440" src="https://studentprojects.in/wp-content/uploads/2022/05/Move-wordpress-website-ssh.jpg" alt="" class="wp-image-9334" srcset="https://studentprojects.in/wp-content/uploads/2022/05/Move-wordpress-website-ssh.jpg 960w, https://studentprojects.in/wp-content/uploads/2022/05/Move-wordpress-website-ssh-300x138.jpg 300w, https://studentprojects.in/wp-content/uploads/2022/05/Move-wordpress-website-ssh-768x352.jpg 768w" sizes="(max-width: 960px) 100vw, 960px" /></figure></div>


<p>Here I will explain how to move the website using SSH. If you do not have SSH access then you can try using cPanel and phpMyAdmin. <a href="https://studentprojects.in/qa/wordpress/move-wordpress-site-new-host-domain/">Click here to read How to move WordPress site to a new server or a new domain using cPanel and phpMyAdmin.</a></p>



<p><strong>Assumptions</strong></p>



<p><strong>Server 1</strong>: Current server where WordPress is set up. This can be your local host also.<br><strong>Server 2</strong>: The server where you want to move the website.</p>



<p><strong>Follow the below steps.</strong> </p>



<h2>1. Server 1: Export database</h2>



<p>To export the database, first find out the name of the database. Login to server 1 SSH. </p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">$ ssh username@websitename.com
$ // When prompted for a password, enter it.
$ // Go to the root folder of the website. 
$ // public_html or /var/www/html/websitename.com
$ cd public_html
$ vi wp-config.php</code></pre>



<p>Here you can find the database name as shown below. </p>



<pre class="wp-block-code"><code lang="php" class="language-php">/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );</code></pre>



<p>Now dump the database into a file.</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">$ mysqldump -u username -p database_name > db_backup.sql</code></pre>



<p></p>



<h2>2. Server 1: Compress the website files</h2>



<p>We&#8217;ll compress the entire website from the root folder(public_html) to make moving the files easier. Use the tar command to compress the files. Below given command will create a compressed file and can be accessed using the URL https://websitename.com/website.tar.gz</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">$ tar -cvzf website.tar.gz ./</code></pre>



<p></p>



<h2>3. Server 2: Import Database</h2>



<p>Login to Server 2 SSH and enter the below-given command to create and import the database.</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">$ mysql -u username -p
$ // When prompted for a password, enter it.

mysql> create database database_name;
Query OK, 1 row affected (0.00 sec)

mysql> exit

$ mysql -u username -p database_name &lt; members.sql</code></pre>



<p> </p>



<h2>4. Server 2: Download the website files</h2>



<p>Download the website zip file created on server 1 to server 2.  Login to server 2 and go to the website root folder. </p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">$ cd public_html
$ wget https://websitename.com/website.tar.gz
$ tar -xvzf website.tar.gz
$ vi wp-config.php</code></pre>



<p>Edit the wp-config.php file and update the database and user details.</p>



<pre class="wp-block-code"><code lang="php" class="language-php">/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );

/** Database username */
define( 'DB_USER', 'username_here' );

/** Database password */
define( 'DB_PASSWORD', 'password_here' );

/** Database hostname */
define( 'DB_HOST', 'localhost' );</code></pre>



<p></p>



<h2>5. Update the DNS records</h2>



<p>Now you have moved the database and all the website files from one server to another. Now is the time to point the domain to the new server. </p>



<p>Login to the domain control panel and go to DNS or name server settings. Point the DNS of your domain name to the new hosting server. Usually, it will take 12-24 hours to update the records. </p>



<h2>6. Browse the website and enjoy! </h2>



<p><span style="font-size: revert; color: initial;">You are done with all the tasks. Open the URL on the browser and check if the website opens properly. </span>Still, your domain may point to the old server and open the website properly. To check whether the website loaded from the old server or the new server, you use the ping command on the command prompt and check the IP. You can also rename the index.php file of the old server and check if the website loads properly. </p>



<p>Just drop a comment if you get any problems while moving the website. I will be happy to assist you. </p><p>The post <a href="https://studentprojects.in/software-development/wordpress/wordpress-installation/how-to-move-wordpress-site-to-a-new-server-or-a-new-domain-using-ssh/">How to move WordPress site to a new server or a new domain using SSH</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/wordpress/wordpress-installation/how-to-move-wordpress-site-to-a-new-server-or-a-new-domain-using-ssh/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
