Welcome Guest, Not a member yet? Register   Sign In
Error 404 with just one controller...
#1

[eluser]slayerdrix[/eluser]
Hi there.

I work on some CI's sites in my company, and on one of them, i've got a problem :
I've got 4 controllers, including "moncompte.php" and "panier.php". When I type http://www.mysite.com/panier/ all work fine, but with http://www.mysite.com/moncompte/ i've got a 404 error from apache...

I've got a local server where /moncompte/ work fine, and controllers and views's files are the same (i didn't have models with them).

I begin with MVC, I didn't install it and the programmer who did it is gone... so I'm a little lost with this problem...

If you know anything that could help me, it will be awesome.

Thank you.


PS : excuse me for my bad english, i'm french ^^
#2

[eluser]Mr. Pickle[/eluser]
Can you post your code here?

Also, what does your serverlogs say?
#3

[eluser]deczo[/eluser]
The problem may lay in mod_rewrite - check .htaccess or vserver config for rewriting rules.
You may have rerouting set up wrong in application/config/routes.php, check this one too.
Another option would be lack of default index() method in controllers (but since it works locally and don't on production serv it would be config/routes.php problem in the end).

By check I mean showing us the code ofc so we can help Smile
#4

[eluser]slayerdrix[/eluser]
first for the .htaccess :
Code:
Options +FollowSymlinks
RewriteEngine On

#RewriteBase /Brochurexpress/
#RewriteBase http://www.brochurexpress.com

RewriteRule brochures/([0-9,]+)x([0-9,]+) brochure.php?largeur=$1&hauteur;=$2&faconnage=3 [L]
RewriteRule dos-carre-colle/([0-9,]+)x([0-9,]+) brochure.php?largeur=$1&hauteur;=$2&faconnage=4 [L]

#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ code.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ code.php [NC,L]
(it's a little different on the local serveur, but it didn't work with it to)

routes.php :
Code:
$route['default_controller'] = "welcome";
$route['scaffolding_trigger'] = "";
(same as the local file)

and if you want the moncompte.php code :
Code:
<?php
/**
* Classe du contrôleur des pages du compte client
*
* @category    Brochure
* @package        Controller
* @subpackage    ClientController
*/

/**
* @category    Brochure
* @package        Controller
* @subpackage    ClientController
*/

class MonCompte extends ClientController{
    /**
     * Page d'accueil de l'administration
     *
     * @return void
     */
    public function index(){
        //Données de la page
        $data = array('swf'=> true);
        
        //Affichage de la vue
        $this->load->view('moncompte/index',$data);
    }
    
    /**
     * Déconnexion de l'utilisateur
     *
     * @return void
     */
    public function deconnexion(){
        $this->logout();
        redirect('moncompte');
    }
    
    /**
     * Affichage de la liste des commandes du client
     *
     * @return void
     */
    public function mes_commandes($reference = null){
        if($reference != null){
            $this->_details_commande($reference);
            return;
        }
        
        //Données de la page
        $data = array(
            'client'    => TableClients::getAuth()
        );
        
        //Affichage de la vue
        $this->load->view('moncompte/mes-commandes',$data);
    }
    
    /**
     * Affichage du détail d'une commande
     *
     * @return void
     */
    private function _details_commande($reference){
        //Recherche de la commande
        $commande = TableCommandes::findByReference($reference);
        if($commande == null){
            show_404();
            exit();
        }
        
        //Données de la page
        $data = array('commande' => $commande);
        
        //Affichage de la vue
        $this->load->view('moncompte/_details_commande',$data);
    }
    
    /**
     * Affichage des factures
     *
     * @return void
     */
    public function factures($commande_id){
        //Chargement de la commande
        $commande = TableCommandes::findById($commande_id);
        if($commande == null){
            show_404();
            exit();
        }
        
        //Données de la page
        $data = array('commande' => $commande);
        
        //Affichage de la vue
        $this->load->view('moncompte/factures',$data);
    }
}
(same as the local file)

I check the serverlog an i reply.
I'm also a trainee so i don't know all in this site...
#5

[eluser]Mr. Pickle[/eluser]
First off, try changing:
Code:
class MonCompte extends ClientController{

to

Code:
class Moncompte extends ClientController{

Class names should only have one uppercase character, the first!
#6

[eluser]slayerdrix[/eluser]
It didn't work...

If you want, the 404 error is :

Not Found

The requested URL /moncompte/ was not found on this server.
#7

[eluser]Mr. Pickle[/eluser]
I'm pretty sure it has something to do with your .htaccess file as the 404 comes from the webserver, not CI.

What happens if you try to comment all the (for CI) unnecessary lines or temporarily replace the file with a CI default .htaccess:

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

If it works with this you should look for an answer in your .htaccess file.
#8

[eluser]slayerdrix[/eluser]
I'm at home now, i'll try in a little hour, thank you.
#9

[eluser]slayerdrix[/eluser]
With this, i've got a "no input file specified" error when i try to access to /panier/ and the same 404 error with /moncompte/...

This error make an other mistake : now, like yesterday, went i access to /panier/ there is no transition of my session variables... (fix itself yesterday, so i just have to wait)

Edit : in fact, with an apache restart, i fix this problem, so i just have the 404 problem now ^^
#10

[eluser]slayerdrix[/eluser]
I found one thing : not depending of the name of the class (MonCompte or Moncompte) if i type /monCompte/, i've got the CI' 404 error, maybe a progress ?




Theme © iAndrew 2016 - Forum software by © MyBB