-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Media Temple Installaton Tips
A few tweaks need to be made to CodeIgniter to make it compatible with the MediaTemple hosting environment. Here is a copy of the .htaccess file we’ve developed:
AddHandler php5-script .php
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^([0-9a-zA-Z]+.js)
RewriteRule ^(.*)$ /index.php?/$1 [L]`
The first thing we’ll want to do is enable PHP5. Unless you have a reason to continue using PHP4 for your application, use the newer version. Specifically, the version of PHP5 used by MediaTemple is 5.2.2, not 5.3, so you won’t need to upgrade CodeIgniter to 1.7.2 to work (CI 1.7.2 introduces PHP 5.3 compatibility).
The second set of rules prevents users from being able to access any files in the system directory. We finally made the leap and pulled my system directory out of the web root and to share it with other websites, so this line isn’t needed, however most people will need it.
The next set of rules sends all incoming URL requests to CodeIgniter, unless the files already exist. This is good if your site is as complex as ours and has a WordPress and a WikiMedia script installed. For some reason, if there are JavaScript files in the root of the web folder, MediaTemple still directs the URL to CodeIgniter, despite the !-f !-d ignore rules that other shared hosts seem to accept, so we’ve had to add the regular expression to ignore JavaScript files.
Inside of your application/config.php file, you’ll want to set your uri_protocol setting to AUTO.
$config['uri_protocol'] = "AUTO";
Finally, if you would like to take the system folder out of your web folder, to share it among other installations, you’ll want to take two steps. First, pull the applications folder out of system and put it in the base of your CI installation folder (along side index.php). Then, move /system up two directories so that it is sitting inside of your domains folder (you can’t go a step higher, which is unfortunate as it seems a little out of place here) and rename it /codeigniter to prevent ambiguity. You’ll then want to update your index.php file so that it uses the following values:
$system_folder = "../../codeigniter";
And now you should be up and running with a CodeIgniter application functioning properly on your MediaTemple host.