Welcome Guest, Not a member yet? Register   Sign In
Default Controller doesnt work on base url.

(This post was last modified: 03-02-2021, 01:16 PM by danielu_ci.)

Hi there,

Just a little help, I already setup most of the things I need in CI 4.1.1. I'm mounting it on a cPanel hosting, and I've already managed to remove the index.php/public from the url. The only problem I can't seem to resolve is to load the default controller when visiting the base url of my application.

I already defined the base url and removed the indexPage on the Config/App.php as the documentation says.

PHP Code:
public $baseURL 'http://domainexample.com/';
$indexPage ''

And in my Config/Routes.php

PHP Code:

 * --------------------------------------------------------------------
 * Route Definitions
 * --------------------------------------------------------------------

// We get a performance increase by specifying the default
// route since we don't have to scan directories.
//$routes->get('/', 'Home::index'); 

So if I visit domainexample.com it doesn't load anything, while domainexample.com/home it loads the page correctly. (it does no difference if I uncomment the routes->get('/', 'Home::index'); line
I'm using a subfolder to separate admin from public page, and if I visit domainexample.com/admin,it loads the home controller in the admin subfolder correctly so the configuration is working.
I'm using the default .htaccess provided in the CI folder on my root directory, I pulled it out of the public folder.

Am I missing a configuration or why doesn't it load nothing when visiting the base url?

Thanks in advance.

In your .htaccess file specify the subfolder by using RewriteBase /subfolder

Theme © iAndrew 2016 - Forum software by © MyBB