Jump to content
xisto Community
Ahsaniqbalkmc

Setting Up A Local Copy Of My Wordpress Website

Recommended Posts

Most people, especially those who own small businesses or host personal websites, use wordpress as their CMS. It is a great content management system as it is easy to maintain and support is awesome. You can find help about any issue you can think of. The reason is that it is so widely used that almost every aspect of it is covered by someone.

Often there arises a need to make some changes in layout or design of the website. It is very easy to do in wordpress. All you require is basic understanding of HTML and PHP. And you can operate and customize your wordpress like a pro. Recently, when I was making some changes to my website, I realized that the website was live during the time I tested various patterns. So anyone who was visiting the website at that particular period of time would have had a bad experience. Things would have changed randomly for him and there also might be some temorary errors shown to him. This might not sound like a big issue for small websites with upto 5k visits a day but for high traffic websites it is a major issue.

I tried to look for various solutions. The one I decided to adopt was creating a local copy of my wordpress website and testing all the stuff I wanted to on that local copy. Then when the customization is final, all I have to do would be just to upload the modified stuff to my server and the website will be updated in one leap. This sounds pretty good in theory but while I was setting up a local copy of my wordpress website, I ran into lot of problems. Most of the problems are now fixed but I am still not able to run my website locally as if it was running on the internet. Below are the steps I took to create a local copy of my website (keep in mind that the local copy I created is still not 100% functinal, which means that I have missed something or done something wrong).

 

Wampp:

First of all I downloaded Wampserver 2.0a. I have previously used Xampp but because I have now shifted to a x64 system, and according to my knowledge, Xampp doesn't fully support x64 yet, so I decided to go with wampp. The process was really easy without any hiccups and every thing went well. After setting up wampp, I opened my browser and entered "localhost", which carried me to the local wamp server page. This indicated that wampp was running fine.

 

Copied my remote website:

The next step was to copy my remote website. I did it through the backup wizard on my cPanel, but the ftp client can also be used for this purpose.

 

Copied my remote database:

Using the same backup wizard, I also obtained a copy of my remote database.

 

Copied my remote website contents to localhost:

Then I copied the all the files and folders of my remote website to the "www" folder in my wampp installation.

 

Created a new database in local server:

Then I created a new database in local server with the same name as the database name on my remote server.

 

Imported the remote database into the local database:

Then I imported the remote databsae into the local database so that every bit of data is transferred to my local server.

 

Created new user:

I created a new user on phpmyadmin on local server with same details on my remote server. Granted it all priviliges.

 

Changed the default location of my wordpress website in local database:

The remote database had default location of my website as "http://www.mananatomy.com/;. As I was going to create a local copy, I changed it to "localhost". I did it by editing the wp-options table in my database.

 

After all that effort, MY WEBSITE DIDN'T WORK LOCALLY.

 

So I tried to follow a different method. I deleted all the files and databases I had uploaded to the local server. Then I downloaded a fresh wordpress copy from wordpress.org and and extracted the contents into the "www" directory of wamp. Then I created a new user and a new database, but the details I used were the same as for the remote server. I configured the new wordpress and installed it with the same details I used for my website when I installed it on my remote server.

 

Then comes the trick that solved many of the issues. I created a new database, imported my original remote server database into it and deleted the wp_options table from it. On the local database that I used for fresh wordpress installation, I deleted all the tables except wp_options. Then I copied all data and structure from the random database (which contained the original contents of remote database) to the local wordpress database.

 

After that I copied the original files of backup and pasted them on top of the fresh wordpress installation in the "www" directory fo wamp. After the files were replaced and directories were merged, I checked if the local website is working. And guess what, it worked.

 

It worked but one major problem still remains. The website is not showing any content. It is showing that there are 336 pages (in the admin area) but the actual website doesn't show any content. The theme is loaded, the CSS loaded but the content isn't there. Furthermore when I click on the links, I am taken to the online version of the website. SO the links are also not working.

 

So here are two problems I need to fix and I need your help on this.

1) Why is the content not appearing?

2) How to make the links work locally and prevent them from going to the online version of the website?

Share this post


Link to post
Share on other sites

OK, it's a standard wordpress migration problem : for temporary testing purposes you need to move your wordpress website from one server (the Xisto server) to another server (your own PC).There are a lot of papers concerning this on the web, just try goggling with the words "wordpress migration" and pay special attention to the "server" parts.Of course, as long as you stay with Xisto, all these migration things are transparent for you, the technical team is in charge of the server migration part without touching any of the servernames or filenames.However, you have to master your wordpress content, because it's your intellectual property, so you have to learn how to make a full backup of your site and move it to any other system, including "localhost" or mynewplace.comThis is the nice feature of our job : we have to master these backup/restore things, or we have to pay (a lot of money) the few geeks able to do this for us.

Share this post


Link to post
Share on other sites

I don't think I would want to "MIGRATE" my wrodpress site from Xisto to anywhere else. I just want a copy of it on my local server to for testing purposes. Or we can say that I want to migrate a copy of my website to another server for testing.

 

I tried to research a lot on the problems I dicussed in my first post. I haven't been able to figure out why the content is not showing up but I have found why the links are not working locally. The problem lies in my website design. I have done linking in an absolute way, which means that instead of using php funcitons like "bloginfo(template_directory);" etc, I have used

http://forums.xisto.com/no_longer_exists/ 
page
. What this means is that when I shift my website to some other place, the website will still look for that full address.

 

This is a problem anyone who plans to migrate or copy his website in coming time must address. Because this absolute linking strategy has made life much difficult for me. Now I am forced to create a new wordpress website that mimics my site design. I will have to perform my tests on this site and then I will translate my modifications to the actual website. So much pain in the a*s.....

Share this post


Link to post
Share on other sites

Nope.The "migration" process is a standard way of talking about that.You leave all the data on the original system.You create a working copy on the new hardware.And if you are satisfied with the new system you remove the old one.And if you want you let both working, one as the live system and the other one as the test system.You simply have to use the "copy" part of the migration process, test the fuctionnality on the new system, and in your case you simply don't remove the data from the original system!Simply read the "migration" technique in order to know how to copy the data and how to modify the new system in order that it points to the new hardware instead of the old one.And remember that, in real life, the migration process is a multi-step process.You first copy the data.Then modify them.You don't like the modifications.You copy again.And when you are satisfied you acknowledge all the change.And then the migration will start in reverse order.The source machine will be your PCAnd the target system will be Xisto.And then you will have a brand new idea for changing everithing.So you first copy the Xisto site on your PC.Then you change everything on your PC.And you don't like the new look and feel on your PC.And you read again from Xisto.And when you are satisfied on your PC you migrate from your PC to Xisto.Life is a perpetual movement.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.