Cloning a drupal site 

Drupal Clone

Just a quick hack and reminder for myself…

Situation: you developed a nice website with drupal on one of your local boxes and you want to clone this literally to a new staging host.This can be as simple as using ftp (all of your drupal source files, including modified themes, extra modules and uploaded files).

Then use phpMyAdmin or a similar tool to dump and restore the corresponding drupal database.

Now you fire up your web browser, and there is that disappointment: you see just an empty, white page, not even single error message!

Luckily, the solution is rather simple: use your admin tool to entirely clean (truncate) the cache_menu table from your cloned database. Maybe you should truncate the other cache tables as well, that won’t hurt in any case.

The next reload will show you the staged web site in all its glory!

Another small catch to be aware of: if you’re using “Clean URLs” and are depending on a .htaccess file, this might not get copied by FTP if you’re using a visual tool (e.g. Cyberduck for Mac OS-X).

In that case, the simplest solution may be to create a new .htaccess file remotely (in Cyberduck: right click and choose “new file” from the context menu). Now edit this file over ftp (Cyberduck: right click on file and choose “edit in => TextWrangler” – or similar). Just copy and paste the contents of your local .htaccess file, save and you’re ready to go.