Mambo to Drupal Migration


The old website of MyWebMyMail.com was running on Mambo, after several updates it finally ended up in version 4.5.5. In one of the earlier versions the site was even hacked due to a security flaw. As the site was constantly being spammed by fake users and Mambo had already evolved to version 4.6.x it was time to make a decision - continue with Mambo or switch to Joomla or Drupal. As support for Mambo seems to be fading the decision was to upgrade to a new CMS. Unfortunately it was just as problematic to transfer the existing content to Joomla as it was to Drupal - no easy way out!

After trying the new version of Joomla and Drupal, the decision was clear, it had to be Drupal. Although the learning curve for Drupal is steep and not everything works flawlessly out of the box (tested with version 6.10), it seems the most reliable CMS with a wide support of professional developers and some very high traffic and well known websites use Drupal as their CMS.

For users who are new to Drupal, here's how to get started (normal installation procedure v6.10):

1.) Download the latest version of Drupal, unzip it on your computer
2.) Rename the file 'sites/default/default.settings.php' to 'sites/default/settings.php'
3.) Upload all files to the 'root' of your webserver
4.) Open the website in your browser and follow the installation procedure

Now you have a basic Drupal site up and running. One of the first things you will probably do is to change the theme, and here you can run into your first problem. If your layout is suddenly gone after you press 'Save' (looks like a missing CSS file) something is wrong with your .htaccess settings. Edit the .htaccess file located in 'sites/default/files' and comment out the lines with Options:

SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
# Options None
# Options +FollowSymLinks


If you would like to add themes you downloaded, unzip them on your computer and add them as a directory to 'sites/all/themes' and enable them via the themes menu.

The basic installation of Drupal comes without any additional functionality. You need to download modules, unzip them on your computer and add them as a directory to 'sites/all/modules' and enable them via the modules menu. The following modules are handy to have and start with:

  • admin Menu: Add a dropdown admin menu on the top of the screen
  • globalredirect: Important for Search Engine Optimization
  • google_analytics: Website statistics
  • mollom: Spam preventer from the same developer as Drupal
  • page_title: Also helpful for SEO
  • pathauto: Create understandable links, also helps with SEO
  • poormanscron: If you can't run a cron yourself
  • sitemap: Creates a XML sitemap, for SEO*
  • token: Required module (dependency)
  • nodewords: Required module (dependency)


If you enable the 'upload' module you can attach files to your stories. However in combination with private download option and Drupal 6.10 it would not pass the filename on to the browser, so the user would download a temporary filename. To overcome this problem, edit the following function in the file 'includes/file.inc':

function file_transfer($source, $headers) {
  if (ob_get_level()) {
    ob_end_clean();
  }

 $source = file_create_path($source);
 
 // Output file to browser
 header("Pragma: public");
 header("Expires: 0");
 header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
 header("Cache-Control: public");
 header("Content-Type: application/octet-stream");
 header("Content-Disposition: attachment; filename=\"".basename($source)."\";");
 header("Content-Transfer-Encoding: binary");
 header("Content-Length: ".filesize($source));
  
  // Transfer file in 1024 byte chunks to save memory usage.
  if ($fd = fopen($source, 'rb')) {
    while (!feof($fd)) {
      print fread($fd, 1024);
    }
    fclose($fd);
  }
  else {
    drupal_not_found();
  }
  exit();
}


The sitemap module which I downloaded from a forum did not work, but with a very small fix (remove the .xml from the module code and add '?q=' to the code - as my site cannot use clean URL's) it worked very good. I attached the modified module below. A XML sitemap is used by search engines from Google and Yahoo, you have to submit the link to the sitemap (?q=sitemap) and they will index the site for you.

Redirecting old Mambo/Joomla links to the correct Drupal content:

The best way to do it is to modify the Rewrite Rules of the .htaccess file in your Drupal installation. However not all shared hosting providers will allow you to that. The best way I came up with, if you have only a few important incoming links, would be to add the following code to the index.php file of your Drupal installation. It checks the Mambo/Joomla story id code and redirects to the correct page:

if (isset($_REQUEST['id'])) {
  if (intval($_REQUEST['id']) == 51) {
    header('Location: http://www.mywebmymail.com/?q=content/easyphpalbum-details');    
    exit;
  }
  if (intval($_REQUEST['id']) == 50) {
    header('Location: http://www.mywebmymail.com/?q=content/easyphpthumbnail-class');    
    exit;
  }
  if (intval($_REQUEST['id']) == 49) {
    header('Location: http://www.mywebmymail.com/?q=content/digital-shop');    
    exit;
  }
  if (intval($_REQUEST['id']) == 43) {
    header('Location: http://www.mywebmymail.com/?q=content/improve-xp-speed');    
    exit;
  }
  if (intval($_REQUEST['id']) == 45) {
    header('Location: http://www.mywebmymail.com/?q=content/linux-usb-stick');    
    exit;
  }  
}


Adding new menus:

Drupal works with 'blocks' and menus. You can create a new menu for example 'My Menu' and add items to this menu, for example a link to your story. Each content item in Drupal is referred to as a 'node'. The node has a number, but if you enabled the pathauto module, you will have a human readable link such as 'my-first-story'. The URL for Drupal to this story will be '?q=content/my-first-story'. In order to display your new menu on the left sidebar, you have to go to 'blocks' select 'My Menu' and assign it to the left sidebar.

Adding a Google advertisement

Create a new 'Input format'; for example 'googlecode' and disable all input options and filters. Create a new block, for example 'Googlead' and select input filter googlecode, paste your Google advertisement code in the block. Then enable the block and add it to the left sidebar or to the main content.



AttachmentSize
sitemap-fixed.zip2.06 KB