09 March 2012

The FastCGI Issue

I was working with a site that had to be migrated from a Virtual Dedicated Server to a GoDaddy 4GH plan and ran into an issue where POST forms passed through mod_rewrite were not being populated to $_POST. I realized that in a FastCGI environment the requests will be redirected as a GET string, meaning that your POST data will be lost. It was a 1-liner in the '.htaccess' file.

The Fix

If you have a R=301 in the brackets [], remove it so it looks like below: [bash] # On FastCGI replace the last line above with this: RewriteRule ^(.*)$ index.php?/$1 [L] [/bash] Enjoy.