Moving a mura site to a subdirectory and fixing links

Mura is an incredibly CMS. I have been slowly migrating to it, so I have learned a lot. I got my site up and running very easily and put it in the web root. However, I needed to move it to a subdirectory instead. Well, that should be easy, I used the the “Create Bundle Site” to make a backup of my webpage. Then on the other install of Mura, I used the “Deploy Bundle” feature to import it in. Everything seemed to work okay, except my links were messed up. For instance, my links were like

http://www.domain.com/index.cfm/helloworld

but they needed to be

http://www.domain.com/subdir/siteid/index.cfm/helloworld

I didn’t really want to go through each one manually and fix it. Luckily, I found out this is easy to do with a mura function (thanks to Steve Wilthington). All you have to do is this:

application.contentUtility.findAndReplace (‘/index.cfm/’,'/subdir/siteid/index.cfm/’,'siteID’);

Pretty simple!