Movable Type Needs Dynamic CGIPaths

Hacks3 Comments

I host a bunch of Movable Type blogs on one server from one installation through virtual hosting. One problem I have is that I had to set my CGIPath value to be the IP address of my virtual server so all the different blogs would work. Although, this messes up cookies since they are domain specific. Orginally, I was just going to create multiple mt.cfg files and link them up to the right hosts but I decided that was a pain.

So to fix this, I went into ConfigMgr.pm and put in a hack that substitutes the server name of the actual request. Insert this code around line 145 in ConfigMgr.pm. I did this in version 2.661 of Movable Type. It should wokr in all versions.


}

close FH;

#

# Begin hack

#

use CGI;

my $q = CGI->new;

if ( length( $q->server_name() ) > 0 )

{

$mgr->set( 'CGIPath', 'http://' . $q->server_name() . '/mt/' );

}

#

# End hack

#

1;

My hope is that this functionality could be included in the next version of Movable Type to support this type of hosting. I don’t understand the significance or need for hard-coding the CGIPath anyway.