Problem loading drivers from my website made with CodeIgniter

0

I am learning how to program dynamic websites with using the framework and I have a first dynamic web made on my PC (localhost) with some things (registration form, log in and sending emails from contact form) that I want to try from a real web server.

After spending a lot of work fixing the routes of the page, modifying the .htaccess and the config.php to adapt everything to the server, the page works but only allows me to enter the main controller, the one that comes by default, sending the error 404 of codeigniter if I want to enter another controller.

I have short URLs configured (so I do not have to enter the annoying index.php to enter each controller, but it does not work).

Example, if I go to:

www.nombredemiweb.com/index.php/controlador

I get error 404 , same as if I enter:

www.nombredemiweb.com/controlador

What can this be?

Thank you very much already.

    
asked by Víctor Méndez 03.02.2016 в 17:49
source

4 answers

1

Do the test of putting the name of the controller that starts in uppercase in the hosting, that is, if the controller is

class User extends CI_Controller {

The driver file must be

User.php

It may be that in your local tests the server you have is not case sensitive and the hosting server does.

    
answered by 07.02.2016 / 02:46
source
0

Notice that the name of the controller is the same as

class Micontrolador extends CI_Controller {

I mean the file would have to be

micontrolador.php
    
answered by 06.02.2016 в 00:06
0

Ask your question Do you happen to use $ config ['base_url'] = ''?

I do not know, maybe you missed it and you wrote a route like your base_url.

The other thing is about the version of Codeigniter that you have, the 3.04 has a weird average update that by default uses the server's IP (or at least it does in my linux, anyway in my Godaddy server not It happens.

the other thing that I leave here the content of the .htaccess that I use may be of some use to you (leave blank the $ config ['index_page'])

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
    
answered by 07.02.2016 в 07:26
0

Do you have the driver script? Most likely, you are not referencing a function ... (in codeigniter the functions within the controllers are the urls of the project)

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');

class Sitio extends CI_Controller {

    public function __construct()
    {

    }

    public function index()
    {
        echo "sitio - index";
    }

    public function general()
    {
        echo "sitio - general";
    }

}

?>

To access it would be: www.nombredemiweb.com/index.php/Site/index www.nombredemiweb.com/index.php/Site/general

    
answered by 04.02.2016 в 04:57