0
votes

http://localhost/project address is my base url

My index uses the controller file at this address. controller->Index.php

I will prepare an admin panel and I want to access the admin panel as follows: http://localhost/project/admin

I want to folder the controller files of the admin panel separately. In that: controller/admin/Index.php

I have set a route like this: $ route ['admin'] = 'admin/Index';

But when I go to http://localhost/project/admin, I get 404 error.

I could not understand where I made a mistake. Thanks for your help.

1
I think you need something like this $route['admin'] = 'admin/admin'; and folder structure of Controllers/admin/Admin.php - Sayd Fuad
It does not work :( - Burak.H
Do you have function index() {} in your Admin.php controller? and also check .htaccess maybe your base URL not setup correctly. check .htaccess format here codeigniter.com/userguide3/general/urls.html?highlight=url - Sayd Fuad

1 Answers

0
votes

Mod_rewrite is not active. And I have added the following settings to apache/2/sitest-available/000-default.conf.

        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # Uncomment this directive is you want to see apache2's
                # default start page (in /apache2-default) when you go to /
                #RedirectMatch ^/$ /apache2-default/
        </Directory>