CodeIgniter Forums
CI4 Redirect points back to the Default Controller only - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: CI4 Redirect points back to the Default Controller only (/showthread.php?tid=80982)



CI4 Redirect points back to the Default Controller only - algates - 01-10-2022

I have a CI4 Project which works well on Windows XAMPP. But, after I upload the same project to Ubuntu, the redirect only loads the Default Controller Page.

I altered the following setting on /app/Config/Routes.php

Before Change:
PHP Code:
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index'); 


After Change:
PHP Code:
$routes->setDefaultController('RunnerList');
$routes->setDefaultMethod('Raw_Data'); 


Set of Routes:
PHP Code:
$routes->get('/''Home::index');
$routes->get('runnerRawData''RunnerList::Raw_Data');
$routes->get('runnerDBData''RunnerList::MDB_Data');
$routes->get('runnerCSVData''RunnerList::CSV_Data');
$routes->get('runnerJSONData''RunnerList::JSON_Data'); 


The Default Controller loads with no issues. But, when I type in the URL to access the other functions (runnerDBData, runnerCSVData, runnerJSONData) under the Controller Module, all points to the DefaultController / DefaultMethod settings only. I have read a lot of articles and modified the .htaccess, set the correct baseurl, enabled apache2 modrewrite, but somehow nothing seems to work the trick for me.

Let me know if you need any further info - Any help would be highly appreciated!!!


RE: CI4 Redirect points back to the Default Controller only - kenjis - 01-11-2022

See https://codeigniter4.github.io/userguide/installation/troubleshooting.html#only-the-default-page-loads


RE: CI4 Redirect points back to the Default Controller only - algates - 01-11-2022

Based on the link provided, I tried all the following options - Still no luck ...
app/Config/App.php:
PHP Code:
public $indexPage '';

public 
$indexPage 'index.php';

public 
$indexPage 'index.php?'


I have set the following Base URL - PHPCI is my Project / Root Folder Name:
PHP Code:
public $baseURL 'http://[::1]/PHPCI/'

Also, for uriProtocol - I have tried all the 3 options as below, still no luck.
PHP Code:
public $uriProtocol 'REQUEST_URI';

public 
$uriProtocol 'QUERY_STRING';

public 
$uriProtocol 'PATH_INFO'