简体   繁体   中英

codeigniter moving from localhost to server

getting 404 error

404 Page Not Found

The page you requested was not found.

config.php

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



$config['base_url'] = 'http://myhost/sitedir';


$config['index_page'] = '';

$config['uri_protocol'] = 'AUTO';

default controlerr

class MY extends CI_Controller{


    function __construct(){
        parent::__construct();

         // language
        if($this->input->post("lang")){
            $this->load->model("language");
            $this->language->lang($this->input->post("lang"));
        }

        // !language

        //$this->lang->load("ge");
        if (!$this->session->userdata('lang'))
            $this->lang->load("ge");
        else
        $this->lang->load($this->session->userdata('lang'));
    }

    /**
     * mtavari gverdis controleri
     */
    function index(){
        $this->load->model("dbs");
        $data['products'] = $this->dbs->get_products_by_limit("products",7);
        $this->load->view("header");
        $this->load->view("index_page",$data);
        $this->load->view("footer");
    }

}

uploaded default ci package in other directory and it working

i don't have a .htaccess file

sorry for my bad english :(

help me :(

根据您的服务器地址编辑此行

$config['base_url'] = 'http://server_addr/sitedir';-->like this

itś Ok. My english i'ts bad too.

If you don't use .httaccess , the URL for you website must be:

'http://website/sitedir/index.php/my'

in the defualt package you can use :

; because del defaul, `

config['index_page'] = '';

, if i don't forget it was set to "welcome". My web site is in codeignite too, and i had this problems too reference at my incial page.

Your Configuration .php is the same as the my. But i use a . httaccess, to clear the index.php URL. i hope help a little .

Your problem is in routing or HTACCESS Set the variable empty as below.

$config['index_page'] = '';

try to replace following variable with these parameters ('AUTO', 'PATH_INFO', 'QUERY_STRING', 'REQUEST_URI', and 'ORIG_PATH_INFO') one by one

$config['uri_protocol'] = 'AUTO';

I had this problem for the longest.. In my case, after messsing with the config file, routes, htaccess, etc... In the end the problem was that my CPANEL server was hosted through Linux and linux is case sensitive when it comes to file names. All my controllers had a capital letter for the first letter of the file name. When I changed this to lower case, it worked fine. Maybe this is your issue as well. Good luck to all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM