Basic newbie question regarding navigation links |
[eluser]sehummel[/eluser]
I'm brand new to CI and have a very basic question. As I recall from my previous limited experience with CI, to refer to a controller in the navigation, we put <a href="controller_name"> rather than adding the PHP extension to it. But yet I get a 404 error when I do this. I know my second controller works because I can load it as the default controller and it loads my view. What am I doing wrong? The controller is in my root controllers folder
[eluser]Madmartigan1[/eluser]
You may not have .htaccess configured, or your CI config. Try http://your_website.com/index.php/controller_name and see what happens. Read the manual as well. Then read it again. It sounds like you may have other issues as far as understanding how CI works.
[eluser]Bart v B[/eluser]
Some code woul be nice. But i am guessing that you forgot to change some config things.. So when you go to <a href="index.php/controller_name"> then it should be right. To remove the index.php you can do that to open config/config.php and change the folow settings: Code: <?php What i always do is using the base_url() The it works alway's correct. example: Code: <a href="<?php echo base_url();?>controller_name/">something</a>
[eluser]Madmartigan1[/eluser]
A little copy/paste from the maunal that may help: Quote:By default, the index.php file will be included in your URLs: And yes, definitely use full urls if you have issues.
[eluser]sehummel[/eluser]
Problem solved. But I had to do this: 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]
[eluser]Madmartigan1[/eluser]
It's from the manual - hence, "A little copy/paste from the manual". Where are you getting a 404? Default controller? Also FWIW, search the forums. There are already tons of posts about this very issue. EDIT: I see you solved it. Thanks for sharing the code so others may benefit from it
[eluser]sehummel[/eluser]
See my comment above. I found this .htaccess here: http://ellislab.com/forums/viewthread/83332/
[eluser]Madmartigan1[/eluser]
<3 .htaccess Just a warning, you may need to tweak for different servers. Good luck!
[eluser]noCodeMonkeys[/eluser]
Is there anyway to accomplish the same thing on a Windows server (iis) that does not use an .htaccess file? |
Welcome Guest, Not a member yet? Register Sign In |