0

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;
fresher
  • 399
  • 4
  • 23
  • What web hosting provider are you trying to use? If it's GoDaddy then you will have to monkey around with the `.htaccess` a bit. – MonkeyZeus Feb 01 '16 at 14:07
  • I am using gungoos right now to testing... is fix of this problem is .htaccess only ? – fresher Feb 01 '16 at 14:45
  • I have no experience with GunGoos, sorry. – MonkeyZeus Feb 01 '16 at 14:51
  • Does GunGoos use Apache? Looking at their homepage I can see the server is identifying itself as NGINX. – MonkeyZeus Feb 01 '16 at 14:54
  • yes they have apache. I also try on acquia. same issue, url are render with /index in last. On my local laptop I am using XAMPP ... and non of these cloud offer XAMPP. Is that a problem? technically I don;t think so. – fresher Feb 01 '16 at 15:02
  • Where is your index.php file located? What does your CodeIgniter routes.php file look like? – MonkeyZeus Feb 01 '16 at 15:07
  • I add my routes.php above. I did setting to get rid of index.php ... and I have separate front end folder at level of application folder – fresher Feb 01 '16 at 15:12

0 Answers0