Tag Archives: Rackspace

Almost Perfect Rackspace Cloud .htaccess for PHP

Dear Reader(s?)

If you use Rackspace Cloud hosting you’ll recognise that thier PHP configuration is gash and you’ll be pulling your hair out trying to figure out why *some* ini_sets fail and sessions just don’t work at all, making you miserable. If you’re not and your hair is intact, good for you.

I learnt through trial and error so here’s what my current .htaccess file for Rackspace looks like

One thing to note is I use the Zend Framework alot, hence the write rules.

#Zend Framework Specific.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

php_value session.gc_probability 1
php_value session.gc_divisor 100
php_value session.gc_maxlifetime 3600
php_value session.save_path /mnt/stor1-wc2-dfw1/654321/12356/www.sitename.com/web/sessions

php_value max_execution_time 3600
php_value upload_max_filesize 100M
php_value post_max_size 220M
php_value memory_limit 256M
php_value magic_quotes_gpc Off

So bit sucky that you have to do that, but credit where credit is due, their live chat support is great. Instant answers to anything you can’t find in their cloud hosting wiki.

Another quality reference page to check is the .htaccess faqs page too, before you start buggin their support agents 😉