• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
404 error from codeigniter when hosted to server (tried every possible conditions)

#11
(05-31-2019, 09:45 PM)Paradinight Wrote:
(05-31-2019, 05:39 AM)chinna Wrote:
(05-31-2019, 04:57 AM)dave friend Wrote: Are you trying to use any special routes?

Please show us the code for the controller and view of one such page.

index is working but login is showing 404 error

First fix the password code... .

https://paragonie.com/blog/2017/12/2018-...-passwords

Second: https://www.codeigniter.com/user_guide/i...ation-rule

Third: Update the php version 5.5 is very old


Back to the problem:
Check if the .htaccess is allowed
may be first two are not the reasons because even when i try to display a static page then also im getting 404 error from codeigniter

third one i upgraded the php to 7.3 still im getting same 404 error
Reply

#12
Can you please write your problem/details/folder structures etc. step by step. So that we can figure it out correctly instead of hitting our head against a brick wall.

For example You mentioned that : "i checked capital letter at starting." in your first post. Did you check the First letters of Model names and Controller names in your related directories?

Or your index function starts with an if(isset()).. What about the else part of the block?

By the way, before everything, can you please try any, simple, "hello world" text to test the welcome page?

Regards.
Reply

#13
(06-01-2019, 02:07 AM)demyr Wrote: Can you please write your problem/details/folder structures etc. step by step. So that we can figure it out correctly instead of hitting our head against a brick wall.

For example You mentioned that : "i checked capital letter at starting." in your first post. Did you check the First letters of Model names and Controller names in your related directories?

Or your index function starts with an if(isset()).. What about the else part of the block?

By the way, before everything, can you please try any, simple, "hello world" text to test the welcome page?

Regards.

bro, this is my code https://github.com/xXCHINNAXx/SimpleLoginCodeigniter

I also tried with static pages

my base controller is Welcome.php

in that i have two functions
1. index
2.login


index is working fine and it is loading my static html page

but login is showing 404 error which is not loading my html page.
Reply

#14
Well, If I'm not wrong in "login part" of your controllerWelcome.php you have got 3 openings of curly brackets, but 4 for closing. (starting line 21 and closing 42).

And also in your route file which is under config, please point to your login part of your controller :

$route['loginn'] = 'welcome/login';

And add this line under $router['default_controller] = 'welcome'; which is main route there now.


Regards.
Reply

#15
(06-01-2019, 08:43 AM)demyr Wrote: Well, If I'm not wrong in "login part" of your controllerWelcome.php you have got 3 openings of curly brackets, but 4 for closing. (starting line 21 and closing 42).

And also in your route file which is under config, please point to your login part of your controller :

$route['loginn'] = 'welcome/login';

And add this line under $router['default_controller] = 'welcome'; which is main route there now.


Regards.

bro, please solve the same problem for below code

Welcome.php

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

class 
Welcome extends CI_Controller {

    
    public function 
index()
    {
        
$this->load->view('home.htm');
    }
    public function 
loginpg(){
     
   $this->load->view('login.htm');
    }
}
?>
routes.php

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


$route['default_controller'] = "welcome";
$route['404_override'] = '';
$route['login'] = 'welcome/loginpg'
With this also getting same 404 error
Reply

#16
Why you need a page ending with .htm on Codeigniter? You are working on Php  

PHP Code:
public function index()
 
   {
 
       $this->load->view('YOUR_VIEW/home');
 
   }
 
   public function loginpg(){
 
       $this->load->view('YOUR_VIEW/login');
 
   }
}
?>

then in the route please try: 

$route['the-url-on-the-browser(name-of-the-file-in-your-view)'] = 'welcome/-the-name-of-the-controller'
Reply

#17
(06-01-2019, 12:45 PM)demyr Wrote: Why you need a page ending with .htm on Codeigniter? You are working on Php  

PHP Code:
public function index()
 
   {
 
       $this->load->view('YOUR_VIEW/home');
 
   }
 
   public function loginpg(){
 
       $this->load->view('YOUR_VIEW/login');
 
   }
}
?>

then in the route please try: 

$route['the-url-on-the-browser(name-of-the-file-in-your-view)'] = 'welcome/-the-name-of-the-controller'
worked bro thanks
Reply

#18
problem solved
that was routing problem.


Thanks to all who spent their time helping me
Reply

#19
(06-01-2019, 08:19 PM)chinna Wrote:
(06-01-2019, 12:45 PM)demyr Wrote: Why you need a page ending with .htm on Codeigniter? You are working on Php  

PHP Code:
public function index()
 
   {
 
       $this->load->view('YOUR_VIEW/home');
 
   }
 
   public function loginpg(){
 
       $this->load->view('YOUR_VIEW/login');
 
   }
}
?>

then in the route please try: 

$route['the-url-on-the-browser(name-of-the-file-in-your-view)'] = 'welcome/-the-name-of-the-controller'
worked bro thanks

bro getting another error

my url is https://www.everstore.com.au/testcod/test/index.php/loginn

it is redirecting to https://www.everstore.com.au/testcod/test/index.php/welcome/loginn
($route['loginn']='welcome/loginn';  i used this in routes.php)

and showing error
The page isn’t redirecting properly


An error occurred during a connection to www.everstore.com.au.

    This problem can sometimes be caused by disabling or refusing to accept cookies.
Reply

#20
It's redirecting right, look at your route.

controller/method
welcome /loginn
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.