Hi all,
first of all i’m very new in developing with CI. Almost 3 days. I still have secrets to discover.
One of them i can’t figure how it should be resolved. for me.
Because i(my application) wanted to have a good relation with images i’ve putted .htacces file with Rewrite rules in my root folder. Everything was ok, until i had to declare multiple functions into base controller other than index().
After i made that and tried to link from a page to one of that functions, i get error 404. Page not found.
my controller(default) look like that:
class ControllerName extends Controller {
function ControllerName() {
parent::Controller();
$this->load->helper('url');
}
function index() {
$data['title'] = "Some title";
$this->load->view('index', $data);
}
function about(){
$data['title'] = "Some title";
$this->load->view('about', $data);
}
In index.php of my page i have a link like that:
<?=anchor('about','About us')?>
And after click on it i get:
404 Page Not Found
The page you requested was not found.
it seems that my mod_rewrite doesn’t use very well links and CI depends on index.php
My mod_rewrite(default one from CI Wiki) looks like that:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /myAppFolder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
What should i do to use mod_rewrite and have access to my controller functions? I think i need a better mot_rewrite rules. Don’t you think too?
P.S. CI is very nice. I’d like to use it for all my app. And i’ve got a lot.
