Results 1 to 13 of 13

Thread: How do you create replica of your blog on your localhost?

  1. #1
    Join Date
    Nov 2006
    Location
    Malaysia
    Posts
    184
    Rep Power
    156

    How do you create replica of your blog on your localhost?

    I have tried before XAMPP, Apache2Triad and another one I cant remember.

    Yet, I only manage to create a basic site from any PHP script that is fresh and new on my PC. I cannot replicate my real LIve site that is online, like say my blog.

    I think its something to do with changing the mysql database once you download it. But which or what are the things to replace?

    The mysql file looks like a huge file in text form.

    I tried to import it in php my admin but it will try to access the real site instead of going thru http://localhost/myfolder

    As for the WP config file, we cant use the real wp-config file that we have, because that one always got a prefix that is your webhosting username you have when you bought the hosting...so I just copy the username and database/password all without prefix.

    And when I load the site in localhost, it is missing all the stylesheet and keep trying to access the live site URL...

    So, basically....how to create a working replica of your site/blog on your localhost PC?

    Coolio

  2. #2
    Join Date
    Apr 2007
    Location
    Penang
    Posts
    504
    Rep Power
    158
    Quote Originally Posted by Coolio View Post
    I have tried before XAMPP, Apache2Triad and another one I cant remember.

    Yet, I only manage to create a basic site from any PHP script that is fresh and new on my PC. I cannot replicate my real LIve site that is online, like say my blog.

    I think its something to do with changing the mysql database once you download it. But which or what are the things to replace?

    The mysql file looks like a huge file in text form.

    I tried to import it in php my admin but it will try to access the real site instead of going thru http://localhost/myfolder

    As for the WP config file, we cant use the real wp-config file that we have, because that one always got a prefix that is your webhosting username you have when you bought the hosting...so I just copy the username and database/password all without prefix.

    And when I load the site in localhost, it is missing all the stylesheet and keep trying to access the live site URL...

    So, basically....how to create a working replica of your site/blog on your localhost PC?

    Coolio

    Copy the whole directory structure from the live site to a new folder on localhost.

    From your live site, export the database tables, then create a database on your localhost and import the tables (phpMyAdmin).... change the website path to http://localhost/myfolder (it's in the 'wp_options' table, 'siteurl' field)

    Then open and edit the wp-config.php, change the settings to match your localhost (db name, user, host) ...... i think i use the default username as "root" (XAMMP), password is blank, host is "localhost"


    define('DB_NAME', 'dbword');
    define('DB_USER', 'root');
    define('DB_PASSWORD', '');
    define('DB_HOST', 'localhost');
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');


    Then try to run in a browser ... hope i din leave out any steps.

    You may need to edit the htaccess if the permalink structure does not work as u expect.

    Hope this helps.
    Last edited by yonghs; 01-08-2007 at 11:50 PM.

  3. #3
    Join Date
    Nov 2006
    Location
    Malaysia
    Posts
    184
    Rep Power
    156
    Hi Yong, Thanks so much. But I didnt understand 2 things:

    Copy the whole directory structure from the live site to a new folder on localhost.
    and

    From your live site, export the database tables, then create a database on your localhost and import the tables (phpMyAdmin).... change the website path to http://localhost/myfolder (it's in the 'wp_options' table, 'siteurl' field)
    I am now trying XAMPP on the top level folder as in E:/xampp/htdocs/site-name

    Also when you say export, you mean export to our PC desktop?

    What I did is I went to the Backup icon in the cpanel and just download (backup) the entire database to my pc. But I'm not sure of this part - changing the website path to be http://localhost/myfolder.

    As I understand I need to go into the PHP my Admin and look up wp_options table and then what to do next?

    What I did was create a blank database with the same name and then I imported the database into it...that part worked, but the URLs are all still the "live" URLs.

    This XAMPP is not so good for permalinks. I think this is better :
    err...[edit]

    This is the best so far for me - Apache2Triad Net
    Last edited by Coolio; 02-08-2007 at 12:45 AM.

  4. #4
    Join Date
    Apr 2007
    Location
    Penang
    Posts
    504
    Rep Power
    158
    I've used Wordpress with XAMPP, the permalink works fine.

    Anyway, I've never copied a live site to localhost b4. But I've copied local sites to live servers, so I think basically just reverse the steps.

    1. Copy the directory structure to your PC means copying the LIVE wordpress files/folders to your local PC. Example: C:\xampp\htdocs\myblog (use any FTP program)

    2. Export the live db tables, use the PhpMyAdmin (live site) to export the tables (guide WordPress Backup with phpMyAdmin)

    3. At the localhost, use PhpMyAdmin to create a new DATABASE (can be anyname), then import the tables. After you have imported the tables, browse the 'wp_options' table, the 'siteurl' field will be something like 'http://www.yoursite.com' .... click the edit button and change to 'http://localhost/myblog' (this is normally done using the Wordpress admin dashboard, but Wordpress is not running on your localhost yet, so use the local phpMyAdmin to edit)

    4. Open the local 'C:\xampp\htdocs\myblog' folder and edit the wp-config.php file as shown in my earlier post.

    5. With XAMPP running (or another choice of urs), open the web browser and go to 'http://localhost/myblog'

    What do you mean by >> but the URLs are all still the "live" URLs ?? The http://localhost/myblog doesn't display anything at all?
    Last edited by yonghs; 02-08-2007 at 08:33 AM.

  5. #5
    Join Date
    Nov 2006
    Location
    Malaysia
    Posts
    184
    Rep Power
    156
    Hi Yong,

    I just finished duplicating my blog on localhost, but there is a problem, all the links do not work. Only the front page...http://localhost/myfolder shows up.

    All the side links like archives, recent posts...all gives 404 error. By the way I have changed all the urls to be http://localhost/myfolder in the database earlier before I imported. It should work, but only the root "domain" works, ie http://localhost/myfolder

    Everything else is ok, except all the links beyond the root do not work. I think maybe the XAMPP is not working for the permalinks, although when I update permalink structure in the localhost blog under WP-Options, it can update to any format you want.

    Very puzzling. Maybe something to do with the httpd.conf file? I found it in the apache directory but dont know what are the rules to set
    Last edited by Coolio; 02-08-2007 at 08:34 PM.

  6. #6
    Join Date
    Apr 2007
    Location
    Penang
    Posts
    504
    Rep Power
    158
    Did u try the "Default" link structure? (E.g: http://localhost/myfolder/?p=123 ) ... this default method does not use MOD REWRITE .. if it works means you have to check your .htaccess file.

    Take a look at your .htaccess file. It should be:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wordpress/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /myfolder/index.php [L]
    </IfModule>

    # END WordPress

  7. #7
    Join Date
    Nov 2006
    Location
    Malaysia
    Posts
    184
    Rep Power
    156
    I did not mention that my blog (the live one) uses a permalink structure of /%category%/%postname%/

    So the urls are all like this http://www.mysite.com/category/postname

    In the localhost, I have changed all the instances of the domain in the databse to be from http://www.mysite.com to http://localhost/myfoldername

    Normally, I dont think there should be a problem...but how come all the urls now give 404 error on the localhost?

    Hmm, also for .htaccess file, I dont see any in my /xampp/htdocs/myfoldername folder...but still I can update permalink structure in the localhost WP admin at ...Wp-options > permalinks

    Xampp on localhost dont use htaccess mah...

    So that is why its beyond me. I even mouse over the links...

    they all look okay...all have been changed to http://localhost/myfoldername/category/postname

    but....give 404 error when I click them

    If anyone knows the answer, or have prior experience, please share - this is what will benefit the forum and anybody else.

  8. #8
    Join Date
    Apr 2007
    Location
    Penang
    Posts
    504
    Rep Power
    158
    My .htaccess file is located at C:\xampp\htdocs\myfolder ...the same location as the Wordpress index.php file... if you have copied the files from the liver server then you should have the file as well... ?

    When I deleted the .htacces file, it gave the 404 error (bcos the permalink won't work)... it's ok if I put back the .htacess file

    If you still can't find the .htaccess file .. create one and put in the following (modify ur folder name):

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wordpress/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /yourwordpressfolder/index.php [L]
    </IfModule>

    # END WordPress

  9. #9
    Join Date
    Nov 2006
    Location
    Malaysia
    Posts
    184
    Rep Power
    156
    Hi Yong,

    I created a htaccess file and put it in inside my wordpress installation on the localhost, which is the htdocs folder, but after that, I see a page that the XAMPP shows me and it has full of error messages and warnings.

    So I dont know if XAMPP can function with a htaccess file.

    Can you give me an example of a complete htaccess file that works with xampp (I will change the url to mine and add it in; see if can work or not)

    I think its the XAMPP issue, because if I use the wordpress default permalink, (the ugly one)...in the WP-Options, it works! (but urls all ugly lor)

    p.s : repped you for taking the trouble
    Last edited by Coolio; 04-08-2007 at 12:00 AM.

  10. #10
    Join Date
    Apr 2007
    Location
    Penang
    Posts
    504
    Rep Power
    158
    Hmm... MOD REWRITE works for me with XAMMP on my localhost. I had exactly the same problem b4 BUT on the live server, bcos i didn't change the path in the .htaccess file.

    Here's the exact content of the .htaccess file (same as what I posted earlier) .... in C:\xampp\htdocs\mywordpressfolder :

    ______________________________________________
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wordpress/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /mywordpressfolder/index.php [L]
    </IfModule>

    # END WordPress
    ______________________________________________

    Note: Copy everything between the lines (exclude the lines) and change "mywordpressfolder" to your own folder name

  11. #11
    Join Date
    Apr 2007
    Location
    Penang
    Posts
    504
    Rep Power
    158
    My apologies, there is another thing u need to do to enable MOD REWRITE for XAMMP. After u are done with the .htaccess above, do the steps below:

    1. Open the Apache configuration file httpd.conf at >>> C:\xampp\apache\conf\

    2. Search for this line >>> #LoadModule rewrite_module modules/mod_rewrite.so (mine is at line 118)

    3. Delete the # mark so the line becomes >>> LoadModule rewrite_module modules/mod_rewrite.so

    4. Go to line 223 and make sure , if it's "None", change to "All" >>> AllowOverride All

    5. Save and start XAMMP.

    This should enable MOD REWRITE for XAMMP ... but if still can't, see this link i've found WordPress Permalinks Does Not Work in xampp Setup My Digital Life
    Last edited by yonghs; 04-08-2007 at 12:39 AM.

  12. #12
    Join Date
    Nov 2006
    Location
    Malaysia
    Posts
    184
    Rep Power
    156
    Hi Yong,

    A big thanks for all the help!!

    Hey, if you want, we can do a 3 way link exchange, just pm me anytime!

    By the way your job site looks really cool, must be a lot of work.

  13. #13
    Join Date
    Apr 2007
    Location
    Penang
    Posts
    504
    Rep Power
    158
    I assume you Wordpress to run properly with XAMMP... that's great

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. The easiest way to create 3-column blog layout
    By genzy in forum Blogging Discussion
    Replies: 4
    Last Post: 12-10-2013, 07:25 PM
  2. Create your new blog with your favourite subdomain names.
    By gmchun in forum Blogging Discussion
    Replies: 3
    Last Post: 29-08-2008, 04:51 PM
  3. Replies: 10
    Last Post: 09-08-2008, 10:56 PM
  4. Replies: 3
    Last Post: 12-04-2008, 12:19 PM
  5. Does we need iis to set php as my localhost server
    By Syazwan in forum Website Programming
    Replies: 15
    Last Post: 07-10-2003, 08:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30