Looking for *good* instructions for copying localhost to live website

javaguy - October 13, 2009 - 03:56

I have some observations from trying to push a site from my local PC onto a subsite on GoDaddy:

* On my PC, in the C:/wamp/www directory, I created a subdirectory wcsd (abbreviation for the intended live site). I intended that the live site had a first-class name like wcsd.org.
* On GoDaddy, I figured out that I had to put this site as a second-class name, such as livesite.com/wcsd. More on that later.
* On GoDaddy, I decided to use their built-in application installer. Not pretty. They force you to install using an invented-on-the-spot MySQL database, with an odd name (something like web123456789.db.1234567.hostedresource.com). You can't load a MySQL DB and then point the installation to it.

* I think it is safest to upload all of the modules and files at this point. I've had failed installs where I didn't upload the modules or themes and Drupal, in an attempt to display *something*, ended up with altering the configuration of footers, blocks, themes, etc. Very awful. I decided a reinstall was easier than fixing things. Anyways, remember copying your module directories and the theme directories.

* Get your files from the sites directory. Some themes (Pixture) store image data into the sites/default/images directory. So if you decide to not just copy the entire sites directory, be sure to look for files the themes may have stashed there.
* I've had a lot of trouble with the GoDaddy Drupal install and the sites directory tree. My files are in the "default" directory. I had need to change the settings.php file. The FTP clients I used (the Java-applet based one on the GoDaddy site *and* the FileZilla client) would choke on the upload because the "default" directory and the settings.php file had no write permissions set. Another thing I found is that the file permissions kept getting set back to read-only. Maybe this is FileZilla, and maybe its interpretation of the Windows file permissions on my (default setup) Windows Vista local PC.

* Truncate the rows in the cache* tables in your DB on localhost.
* Export the DB to a SQL file and import it into your live site.
* On the live site DB, remember to change values in the "variable" table. A number of them probably point at files on your local PC, such as the temp directory.
* On the live site DB, your watchdog table contains all sorts of direct references to your local PC. You might want to truncat this table.
* Now try running your live site. It should *mostly* work.

What is different between "exactly" and "mostly" working? The relative paths, and I'm asking for advice here.

On my local PC, I set up paths like "/node/29". That resolved to "wcsd.org/node/29", which pointed at a page on my site (I told the "hosts" file that 127.0.0.1 was aliased to wcsd.org). But the same path ends up at "livesite.org/node/29", which is wrong. It should be "livesite.org/wcsd/node/29". My question is:

How can I convince a link, like [a href="somemagicvalue/29"], to be correct for both the wcsd.org/node/29 and livesite.org/wcsd/node/29 versions? That is, what would "somemagicvalue" be, or is there some configuration I missed?

In your .htaccess file ...

matt_harrold - October 13, 2009 - 05:54

In your .htaccess file ... scroll to the section indicated here:

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
RewriteBase /wcsd

If you don't have access to the .htaccess file for some reason ... search Drupal fro GoDaddy articles ... I reckon someone has figured it out.

 
 

Drupal is a registered trademark of Dries Buytaert.