Take the 2-minute tour ×

I am using CodeIgniter with REST APIs and Backbone.js. Web server is lighttpd. I also have lighttpd.conf changed for rewriting URLs to remove index.php from urls as follows:-

url.rewrite-once = (
 "/(css|files|img|js|stats)/" => "$0",
 "^/([^.]+)$" => "/index.php/$1"

The call from js reaches to Codeigniter Put function but the value for $this->put() is empty. Please help me out in tracing why the value for PUT data is empty.

Note: This works perfectly fine when I don't rewrite the URLs. Also this works for Apache web server.

On debugging REST_Controller.php file, in the function "protected function _parse_put()", I found out that the contents of file "php://input" is also empty

Following is the Request Headers and Payload taken from Chrome Web inspector, while making a PUT Call:-

**Request Headers**
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/json
X-Requested-With: XMLHttpRequest
**Request Payload**
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

you can use Backbone.emulateJSON = true;

This is the best answer for your doubt :)

Backbone.js PUT/DELETE problems with Codeigniter REST server

share|improve this answer
add comment

Your Answer


