404 Not Found - sure it's simple but can't figure it out |
[eluser]gypmaster[/eluser]
Hi, CI Newb and trying to follow a book on developing CI applications. Going ok except I keep getting a 404 Not Found Error, specifically: The requested URL /ci/welcome/cat/7 was not found on this server. when trying to access a function called 'cat' in the welcome controller. I have a link from the 'home' page to the /ci/welcome/cat/7 url .. the link looks fine and should work. I have a controllers called cat in the welcome controller - here's some of the code in the controller. Code: <?php Here's my .htaccess: Code: RewriteEngine on anyone help with this? TIA
[eluser]wabu[/eluser]
I'm wondering about the directory "ci"--could there be some confusion about where everything's located?
[eluser]gypmaster[/eluser]
Hi wabu, Here's what I've got in my config.php file: Code: $config['base_url'] = "http://localhost/ci/";
[eluser]wabu[/eluser]
Does everything live in "ci"? How about taking the "ci" out of your link (since that's "home")?
[eluser]Chad Fulton[/eluser]
It's your .htaccess which is wrong, I think. Your RewriteRule has /index.php/$1, which makes it look in your base directory (http://localhost/) for the index.php file, which I suppose is not there. Remove the first / to make it look in the current directory rather than the document root. You can do: Code: RewriteEngine on
[eluser]gypmaster[/eluser]
Everything 'lives' under "ci" For example: ci\system\application\controllers is the full path to the controllers folder I changed the .htaccess but it made no difference. Here's how the link is built in the code: Code: echo anchor("welcome/cat/$id",$name); any other ideas? thanks
[eluser]wabu[/eluser]
Does the index function in your welcome controller work? Is it just cat that isn't working? [Cats have an unfortunate reputation as being lazy.] Does .htaccess live in "ci" too, or your site root?
[eluser]gypmaster[/eluser]
Hi, lol, cats are very lazy ... except when depositing in my garden seriously though, the index function does work just fine. .htaccess lives in "ci", should it be somewhere else? Cheers.
[eluser]wabu[/eluser]
Okay, another try: If you paste the following directly into your browser address bar, does it work? http://localhost/ci/welcome/index/ If so, does pasting this one directly into your browser work? http://localhost/ci/welcome/cat/5 You might have tried this already--I'm just trying to cover all the bases here. [Also you might simplify cat() to just "echo $id;" or something until it works.]
[eluser]gypmaster[/eluser]
[quote author="wabu" date="1249516802"]Okay, another try: If you paste the following directly into your browser address bar, does it work? http://localhost/ci/welcome/index/ If so, does pasting this one directly into your browser work? http://localhost/ci/welcome/cat/5 You might have tried this already--I'm just trying to cover all the bases here. [Also you might simplify cat() to just "echo $id;" or something until it works.][/quote] I'd tried simplifying the cat controller but hadn't tried directly trying to reference the controller via the browesr address bar ... so I tried that and it didn't work. I typed http://localhost/ci/welcome/index/ in the address bar and get the 404 Not Found screen. thanks for perseverance! |
Welcome Guest, Not a member yet? Register Sign In |