⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

404 Page not Found - index.php/examples - Codeigniter 4 - Grocery Crud v2.0.0-BETA



Andware
  • profile picture
  • Member

Posted 18 May 2020 - 09:16 AM

Hello

 

I am new on php and Codeigniter 4 with grocery-crud-codeigniter-4 and have not much knowledge om php or codeigniter yet.
I have installed which are described in Readme file but i recipient every time a message that site not found (404 Page not found)!

Jeg har installeret Codeigniter 3 med købmand 1.6.3 og der har jeg ikke nogen problemer.

Can you tell me what I'm doing wrong. Maybe it has something more Routes to do?

Here some more info:

<>404 - File Not Found    <p>
                        Controller method is not found: index                    </p>
</div>

 


kilden
  • profile picture
  • Member

Posted 24 June 2020 - 18:52 PM

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 !

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

'