Migrating from a pre-Drupal site
My old site had been hosted somewhere I had no facilities beyond static HTML. Rather than go through each page putting it into Drupal manually or figuring out how to migrate them all with a clever script (there weren't that many pages!), I went for the simplest solution I could think of.
First requirement, I wanted them to retain their existing URLs. It would be really mean to break old links from elsewhere. And changing the URLs would affect my Google page ranking -- instead of being somewhere down beyond 7 billion I would sink to 20 billion! :)
The method I came up with had two aspects:
- copying the files to my new hosting, nearlyfreespeech.net (NFSN)
- making them visible
I chose to copy my files via another location, where I was backing them up, but I could have done something like:
cd /home/private
mkdir oldsite
cd oldsite
wget -r ftp://user:password@example.com
Of course that assumes ftp access to the old site, this depends on the old site, not on NFSN.
I moved the parts of that tree that I wanted to keep on the new site into subdirectories of /home/public.
But when I tried them from a browser, all I got was a 404 error.
After a rather hasty crash course on Apache's rewrite (mod_rewrite, RewriteCond, RewriteRule) I realised that the reason was the .htaccess file that Drupal puts in /home/public.
I'm sure someone who thoroughly understands this topic could hack that file, but I went for the more cautious solution, putting a little .htaccess file in each first level subdirectory that I wanted to expose. This contains:
DirectoryIndex index.htm
For a quick check that nothing's forgotten, try:
find . -name .htaccess |xargs ls -l
which should display something like:
-rw-r--r-- 1 me me 3964 Jul 1 20:37 ./.htaccess
-rw-rw-r-- 1 me me 26 Jul 5 18:31 ./abc/.htaccess
-rw-rw-r-- 1 me me 26 Jul 5 18:31 ./def/.htaccess
-rw-rw-r-- 1 web me 93 Jun 26 15:38 ./files/.htaccess
-rw-rw-r-- 1 me me 26 Jul 5 18:35 ./ghi/.htaccess
-rw-rw-r-- 1 me me 26 Jul 5 18:35 ./jkl/.htaccess
-rw-rw-r-- 1 me me 26 Jul 5 18:35 ./mno/.htaccess
-rw-rw-r-- 1 me me 26 Jul 5 18:36 ./pqr/.htaccess
...
Notice that Drupal's main .htaccess file is a lot bigger (you don't want to overwrite that one or your site will be ruined) and there's also a special one in the 'files' directory that Drupal uses for uploaded files. That one contains something like:
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options None
Options +FollowSymLinks
With these .htaccess files in place I was able to see my old site content and even add navigation menus to my Drupal pages to point at them. Of course, once a visitor goes there, suddenly the site is a lot less friendly, no nice navigation menu, all just as horrible as my site always was!
- Login to post comments
