The easy way to change your domain name with a mutli-site setup

(2 minute read)

I used to dread changing the domain name of a site running Drupal in a multi-site setup. After changing the folder name all of my attached files would be broken, possibly some of my links would be broken and I would have to delve through thousands of records in the database to hopefully fix the broken files and links. Now I don’t dread it at all since I figured out I could get around all of these problems by using symbolic links.

Preface: Now for those of you who don’t know, symbolic links are a way to make a file or directory appear in multiple places while still referencing the same file[1]. The method I use requires symbolic links to work properly so you pretty much have to be hosting your site on some type of Unix system (FreeBSD, Linux, OS X, etc. Pretty much anything but Windows).

When I decided to move to the steps were easy. I first renamed my directory to[2]. After the directory was renamed I created a symbolic link with the name of that pointed to This way when Drupal outputs the html pointing to the old address the file system will pull the file from the real directory. This even works for deleting old files so if I tell Drupal to delete an image file in the directory the symbolic link redirects that request to actually delete the file from

Now that the filesystem is redirecting those bad requests, I’m now free to clean up the database at my leasure (and this might spawn a post at a later date :)


[2] I rename my directories in a shell. Most low cost web hosts don’t allow you to have shell access so if you don’t have shell access try to rename your directory in your FTP client. If your FTP client wont let you rename a directory then I would recommend you download your directory to your local computer, rename the directory locally and upload the renamed directory (remember to chmod 777 your files directory).