error 404 while accessing api

110 Views Asked by At

I am using PHP codeigniter and chriskacerguis/codeigniter-restserver.

My directory structure is as below

├───cache
├───config
├───controllers    <-- api.php
│   └───api
├───core
├───helpers
├───hooks
├───language
│   ├───bulgarian
│   ├───english
│   └───portuguese-brazilian
├───libraries
├───logs
├───models
├───third_party
└───views
    └───errors
        ├───cli
        └───html

my .htaccess is as below

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

<IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0
</IfModule>

I edited my config.php entry

$config['index_page'] = 'index.php';

Everything is working absolutely perfect on my local laptop. When I moved my code to server, it not working.

for example, access url like http://www.example.com/pal/api/class/ -geting 404

while, if I do locally : http://localhost:88/pal/api/class/ its returning my output JSON

I noticed, in log file on server (not on local) url actually rendering like http://www.example.com/pal/api/class/index

I am assuming that /index in end of url is causing problem.

Can anyone suggest how to fix this? I scanned and clear for all hardcord "localhost" in my code before moving to server ...

**my **routes.php** is as below**

$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
0

There are 0 best solutions below