if(){
redirect('Login');
}
I have a condition above that redirect the page to log in depending on some values. I can see in url that I get redirect because when I enter
http://www.myapp.com
it changes to http://www.myapp.com/Login
Now In my route I have:
$route['default_controller'] = 'welcome';
$route['Login'] = 'login';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
My Login controller looks like:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Login extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->library('session');
$this->load->model('Login_model');
}
public function index(){
$data['title'] = 'GYM';
$this->load->view('login',$data);
}
}
In my view I have
But why Im getting
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
www.myapp.com
Apache/2.4.33 (Win32) OpenSSL/1.1.0h PHP/7.2.7
I cant figure out where I got configuration wrong
Update:
change config file:
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';//'AUTO';
$config['url_suffix'] = '';
$config['language'] = 'english';
$config['charset'] = 'UTF-8';
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'MY_';
$config['composer_autoload'] = FALSE;
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
and
RewriteEngine on
RewriteCond $1 !^(index\.php|[Javascript / CSS / Image root Folder name(s)]|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
accessing:
http://www.myapp.com/index.php/Login
Works but all the above does not. I not getting why