• I installed wordpress on my host site some weeks ago and got it running ok and then decided to duplicate that site on my home machine running LAMP and just copied the files from host to local, dumped the database and created it locally, changed my wp-config.php with local database user etc. and when I run it on Apache just the header loads. So I realized that all the internal links refer to my host site not local. Is there a different way I should have done this? Is there anyway to globally change the links that need to be changed? Or do I have to go in and edit the files? If so where? Thanks all.

Viewing 8 replies - 1 through 8 (of 8 total)
  • SImplest method is just to open your sql in a text editor, then do a find and replace on all instances of http://oldurl.com with http://newurl.com.

    I do it all the time, and it nevers misses a beat.

    Thread Starter Jack

    (@jacknet52)

    This really looks daunting. There must be hundreds of incidences of code pertaining to my url including email addresses etc.Not all have to be changed and not all the same way. Does Apache require the “www.”? I mean do you guys actually run 2 copies of your website: one “on site” and one on the developmental computer. Don’t you have to change your database every time you make a mod to your development program and then upload to your site? Is there some document in here that speaks directly to running 2 copies of your site? One on site and one locally?

    I run a local copy of any site using a seperate domain suffix.

    So, say I’m developing a site for http://widgets.com I’ll set up my local install at http://widgets.loc.

    Then when I migrate from dev to live sites, I do a find and replace on the widget.loc string, replacing with widget.com.

    No, not generally, Apache does not require it.

    Yes, if you are developing a local site, and you want to take any changes you have made locally to your live setup, you need to reflect your local changes to your database to your live sites database.

    Thread Starter Jack

    (@jacknet52)

    @noponies: Thank you for all your help and response. Ok I got the main index.php page to post on Apache2:localhost. But none of the catagory, or page links work. Can you tell me what else I need to fix. I’m assuming I have to go into the WordPress files in my www folder now and replace…?

    How have you set up your local environment? Is it in MAMP, or something similar or are you just running the site from your machines web folder?

    I use a mac and run my wordpess installs from my users/sites folder.

    But it sounds like you have got a mod rewrite issue, or your sites permalinks are out. You dont need to change URLS in your wordpress php files. The find and replace occurs in your databases SQL file.

    Thread Starter Jack

    (@jacknet52)

    Hi again @noponies – I use LAMP with Ubuntu 11.10. Sorry I didn’t say that earlier. I open a browser and type “localhost/wordpress” and it goes to my www folder, which I modified in Apache to run from my Home folder. And the whole first page loads, just like on my live site but none of the links work ie: comments, posts, catagories etc.

    What are your permalink settings? Are you able to get into the back end of your site?

    Sometimes its simpler when setting up on a local host to set permalinks back to their default, as this removes any need for mod rewrite.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘installing on localhost???’ is closed to new replies.