Hello, I've got the same issue. For me, it's seems to be a problem of base_url or routing with Ajax functions. But I don't succeed in fixing it.
- My app (Codeigniter-4) is set in a subfolder called 'myapp'.
- So I set the base_url in app/Config/App.php like this : public $baseURL = 'https://mydomain.local/myapp/';
- The same for the .env : app.baseURL = 'https://mydomain.local/myapp/
- In my header.php, I add the base in the <head> :
<head> <base href="<? echo base_url(); ?>/" target="_self">
- and then a bootstrap menu with links like this :
<li><a class="nav-link" href="'.base_url().'/customers_management">customers</a></li>
- I've changed the routes like this to test the exemple of Grocery Crud (and rename the Controller "Crud"):
$routes->get('customers_management', 'Crud::customers_management');
$routes->get('customers_management/(:segment)/(:num)', 'Crud::customers_management/$1/$2', ['filter' => 'auth']);
I've bought and also installed bootstrap-4.
First, I see perfectly the table of customers... Even when I want to edit, I see one customer and I can cancel... But then :
All buttons (with Ajax) make issues :
- the green button "Update changes" indicates : "An error has occurred on saving."
- the blue button "Update and go back to list" indicates : "An error has occurred on saving."
My js console indicates :
Failed to load resource: the server responded with a status of 404 (Not Found)
https://mydomain.local/myapp/index.php/customers_management/update_validation/119
And indeed : there is an undesirable segment "index.php".
The button "add" and "export" makes the same problems and all the Ajax function...
https://mydomain.local/myapp/index.php/customers_management/add
https://mydomain.local/myapp/index.php/customers_management/export
Should I make special routes for this ? Or can I fix this with a setting or modification in my code ?
huge thanks for any help !
'