This seems like another problem in SO:
jQuery Ajax returns 404 error but correct answer
but the above is very specific for Wordpress. Also, my gut feeling is that my problem is more about setting up the Apacher server, but I'm a little new to this.
Here's the deal ... I have a jQuery AJAX code:
events: function(start, end, callback) {
$.ajax({
type: "POST",
// This Works
url: 'http://calendar.localhost/index.php/myfeed/',
// This Fails
//url: 'http://calendar.localhost/myfeed/',
dataType: 'json',
cache: false,
data: {
appointment_id: _appointmentId
},
success: function(d) {.... },
error: function(x,s,e) {... }
});
When I use url with index.php everything works fine. However, when I use one without index.php, I get a 404 error, even though the data (json) is returned in order (see below).
In addition, this happens on a new system that I recently upgraded to: Debian 2.6.32 (amd64) PHP 5.3.3 Apache 2.2.16
(../myfeed index.php) : Fedora 8 (, 8 lol) PHP 5.2.x Apache 2.2.6
( : '/myfeed' url, . , , .
, - 3 (.. php, apache linux-), - Apache ( - - root dir '/' , ... , , , , , . php, ???).
- , !!!!
Firebug :
POST http://calendar.localhost/myfeed 404
Headers tab:
Response Headersview source
Date Tue, 22 Mar 2011 06:22:37 GMT
Server Apache/2.2.16 (Debian)
X-Powered-By PHP/5.3.3-7+squeeze1
Vary Accept-Encoding
Content-Encoding gzip
Content-Length 220
Keep-Alive timeout=15, max=90
Connection Keep-Alive
Content-Type text/html
Request Headersview source
Host calendar.localhost
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110302 Iceweasel/3.5.16 (like Firefox/3.5.16)
Accept application/json, text/javascript, */*; q=0.01
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 300
Connection keep-alive
Content-Type application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With XMLHttpRequest
Referer http://calendar.localhost/index.php/client
Content-Length 36
Response tab:
{"eventArray":[{"id":"2","notes":"test client Thurs","start":1299951000000,"end":1299960900000},{"id":"3","notes":"test bb334343","start":1300064400000,"end":1300068000000},{"id":"5","notes":"New appt dafdaf","start":1300462200000,"end":1300465800000}, {"id":"35","notes":"japan2","start":1300539600000,"end":1300545000000},{"id":"47","notes":"helo customer test","start":1300471200000,"end":1300475700000},{"id":"50","notes":"test 2 x email","start":1300455000000,"end":1300455900000}]}
:
~ mod_rewrite ? , , ( CI , ).
~.htaccess CI www? :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
,
PHP- ( ):
public function viewEvent()
{
...
$appointmentData['startDate'] = $startDate;
$appointmentData['startTime'] = $startTime;
$data = array( 'eventData'=>$appointmentData );
echo json_encode($data);
}
, Apache :
[Tue Mar 22 10:45:03 2011] [error] [client 127.0.0.1] File does not exist: /var/www/calendar/myfeed, referer: http://calendar.localhost/