Dreamhost, dammit. They seem to get a lot of criticism, but for my testing, fiddling purposes it’s more or less perfect – their shared hosting is cheap and they offer SSH access, and the ability to run Ruby apps alongside the usual PHP action.
But getting CodeIgniter to do clean URLs was a faff. Out of the box with CodeIgniter you get this….
…when instead you want this:
The trick is down to some .htaccess faffing. (Sysadmins will balk at this, because the right place to fix this is in httpd.conf, but with Dreamhost we don’t have that level of access). Your .htaccess file should look something like this:
RewriteBase /squirrels
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /squirrels/index.php?/$1 [L]
Note the ? after the index.php.
I also add this at the top to enable compression of the content being transmitted:
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript text/javascript application/x-javascript
</IfModule>
In my config.php file I also had to change my uri_protocol parameter, like this:
…and then we’re done – clean URLs in CodeIgniter on Dreamhost.
14:01
michael p wrote...
holy crap thank you youre the only person who had the hookup! kudos!