CodeIgniter subfolders and URI routing
Posted
by
shummel7845
on Stack Overflow
See other posts from Stack Overflow
or by shummel7845
Published on 2010-12-30T15:51:15Z
Indexed on
2010/12/30
15:54 UTC
Read the original article
Hit count: 142
codeigniter
I’ve read the manual on URI routing and views and something is not clicking with me.
In my views folder, I have a subfolder called products. In there is a file called product_view. In my controller, I have:
function index() {
$data['title'] = 'Product Overview';
$data['main_content'] = 'products/product_view';
$this->load->view('templates/main.php', $data);
}
The template loads a header view, a footer view and a navigation view, plus the view as a main content variable.
In my URI routing, I have:
$route['products/product-overview'] = 'products/product_view'];
This causes a 404 error when I try to go to domain.com/products/product-overview. Do I need to do something with my .htaccess? If so, what? Here is my .htaccess:
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
I’d appreciate some specific help, as the documentation isn’t specific on how to address this. I’ve done a little searching in the forums, and didn’t see anything, but I’m posting this while I keep looking.
© Stack Overflow or respective owner