Before you mark it as duplicate FIY I have tried all solutions I could find on SO.
The url is www.deltadigital.ca
config file (if I use $config['base_url'] = 'http://www.deltadigital.ca' - it doesnt work at all)
//$config['base_url'] = 'http://www.deltadigital.ca';
$root=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
$root.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
$config['base_url'] = $root;
.htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond $1 !^(index\.php|assets|woff|eot|img|css|js|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/index/?$ $1 [L,R=301]
</IfModule>
It's giving me my webhost's 404 error. I tried other solutions on SO and it's either giving me 500 server error or codeidniter's 404 error
routes.php
$route['default_controller'] = "tlc/view";
$route['/([a-z]+)'] = "tlc/view/$1";
$route['404_override'] = '';
And this is my controller
class Tlc extends CI_Controller
public function view($page='index')
{
if ( ! file_exists(APPPATH.'/views/tlc/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
else
{
$this->load->view('tlc/templates/header.php');
$this->load->view('tlc/'.$page);
$this->load->view('tlc/templates/footer.php');
}
So basically Im trying to make menu links work. They only work with full url i.e. deltadigital.ca/index.php/tlc/view/about-us
It's CI 2.2.2, host is 1and1, my view files are in views/tlc folder
update: removed the leading slash:
$route['([a-z]+)'] = "tlc/view/$1";
Okay, as stated before I am not a CodeIgniter guru. What I do know is that the following works for me:
Config:
Routes:
Controller:
.htaccess:
(Upon writing my answer, I see that you do not currently have the last rule, as shown.)