mod rewrite - Moving cakePHP 2.3.4 REST API from development to production 404 errors -
i working on simple rest api, working on development system (mac osx, zend studio, zend server ce - http://localhost:10088/apitest/
) rewritebase in .htaccess files (see below). modified .htaccess files use apache 2.2 virtual host created (https://api.domain.com/
) , receiving 404 errors. changes (1) rewritebase lines in .htaccess, https: access in url.
error response:
<response> <code>404</code> <url>/v1/flightlogs/9230.xml</url> <name> controller class flightlogscontroller not found. </name> </response>
** commented rewritebase lines below working in development. **
/v1/.htaccess:
<ifmodule mod_rewrite.c> rewriteengine on #rewritebase /apitest/v1/ rewritebase /v1/ rewriterule ^$ app/webroot/ [l] rewriterule (.*) app/webroot/$1 [l] </ifmodule>
/v1/app/.htaccess:
<ifmodule mod_rewrite.c> rewriteengine on #rewritebase /apitest/v1/app/ rewritebase /v1/app/ rewriterule ^$ webroot/ [l] rewriterule (.*) webroot/$1 [l] </ifmodule>
/v1/app/webroot/.htaccess:
<ifmodule mod_rewrite.c> rewriteengine on #rewritebase /apitest/v1/app/webroot/ rewritebase /v1/app/webroot/ rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ index.php [qsa,l] </ifmodule>
apache rewrite log:
[api.domain.com] (2) [perdir /home/level/public_html/api/v1/] trying replace prefix /home/level/public_html/api/v1/ /v1/ [api.domain.com] (2) init rewrite engine requested uri /v1/app/webroot/flightlogs/9230.xml [api.domain.com] (1) pass through /v1/app/webroot/flightlogs/9230.xml [api.domain.com] (2) [perdir /home/level/public_html/api/v1/app/webroot/] rewrite 'flightlogs/9230.xml' -> 'index.php' [api.domain.com] (2) [perdir /home/level/public_html/api/v1/app/webroot/] trying replace prefix /home/level/public_html/api/v1/app/webroot/ /v1/app/webroot/ [api.domain.com] (1) [perdir /home/level/public_html/api/v1/app/webroot/] internal redirect /v1/app/webroot/index.php [internal redirect] [api.domain.com] (2) init rewrite engine requested uri /v1/app/webroot/index.php [api.domain.com] (1) pass through /v1/app/webroot/index.php [api.domain.com] (1) [perdir /home/level/public_html/api/v1/app/webroot/] pass through /home/level/public_html/api/v1/app/webroot/index.php
i can stat final path: /home/level/public_html/api/v1/app/webroot/index.php
[root@l4 httpd]# stat /home/level/public_html/api/v1/app/webroot/index.php file: `/home/level/public_html/api/v1/app/webroot/index.php' size: 3189 blocks: 8 io block: 4096 regular file device: fd00h/64768d inode: 2620573 links: 1 access: (0644/-rw-r--r--) uid: ( 501/ level) gid: ( 506/tracking)
apache 2 virtual host:
<virtualhost *:443> serveradmin webmaster@airlinecert.com documentroot /home/level/public_html/api servername api.levelflight.com:443 errorlog logs/api_ssl_error_log transferlog logs/api_ssl_access_log loglevel warn rewriteengine on rewriteoptions inherit rewritelog logs/api_rewritelog_log rewriteloglevel 2 <directory "/home/level/public_html/api"> options -indexes followsymlinks multiviews allowoverride order allow,deny allow </directory> </virtualhost>
apache access log:
173.60.78.93 - api_username [13/may/2013:06:20:56 -0700] "get /v1/flightlogs/9230.xml http/1.1" 404 181
apache error log:
[mon may 13 06:20:56 2013] [error] [client x.x.x.x] core.php:setdebug:server_name: api.levelflight.com debug:2
the url difference are:
development: http://localhost:10088/apitest/v1/flightlogs/9230.xml
production: https://api.domain.com/v1/flightlogs/9230.xml
something should hitting me in face, can can not see it. ideas?
/v1/app/tmp/logs/error.log
2013-05-13 06:05:38 error: [missingcontrollerexception] controller class flightlogscontroller not found. exception attributes: array ( 'class' => 'flightlogscontroller', 'plugin' => null, ) request url: /v1/flightlogs/9230.xml stack trace: #0 /home/level/public_html/api/v1/app/webroot/index.php(109): dispatcher->dispatch(object(cakerequest), object(cakeresponse)) #1 {main}
~
looks case sensitivity issue. difference between mac osx (not case sensitive) , red hat (case sensitive). flight logs controller , model inconsistent: flightlogs
, flightlogs
both used.
i located instances of flightlogs
, changed them flightlogs
, error seems have gone away.
...the difference between l , l...
Comments
Post a Comment