Stumped. Controller function not being executed?

#1
[eluser]nchmura[/eluser]
I have been staring at this all morning and it is killing me.

First off though, I am loving CI. I am currently working on another project using Zend and I hate going back to it Smile Thanks for a wonderful framework!

So here is my situation: I am having a problem where I can load up a controller and view just fine only as long as it is the default function (index) in the controller. For example, if I try:

http://mysite.com/home (or just http://mysite.com/) - it executes just fine.

If I throw in a controller function like this:

http://mysite.com/home/test

I get a CI "404 Page Not Found" error.

My controller looks like this (stripped it down to nothing troubleshoot):
Code:
class Home extends Controller {

    function Home()
    {
    parent::Controller();    
    
    }
    
    function index()
    {
       $this->load->view('home');
    
    }
    
    
    function test()
    {

      $this->load->view('home');
    
    }
}

Unsurprisingly so, my log file looks like this:

Quote:DEBUG - 2009-01-17 09:11:09 --> Config Class Initialized
DEBUG - 2009-01-17 09:11:09 --> Hooks Class Initialized
DEBUG - 2009-01-17 09:11:09 --> URI Class Initialized
ERROR - 2009-01-17 09:11:09 --> 404 Page Not Found --> test

I am on developing on Dreamhost and did follow this dreamhost htaccess wiki article.

Last tidbit, my route def cont is set to this: $route['default_controller'] = "home";

To me this is telling me some sort of htaccess problem, I have tried all sorts of things, but I get nothing but bupkis.

Any ideas?

Thanks.

#2
[eluser]Sarfaraz Momin[/eluser]
Did you try having the index.php in your URL just to check if that works. In case it works then there is a sure problem with your .htaccess file. I do not have any dreamhost hosting so I can just work around to see if some options work.

#3
[eluser]nchmura[/eluser]
Ahhh, just did that and it works... Thanks. So it is the whole htaccess shebang. Well that was frustrating Smile

I am not 100% concerned on getting it running index.php-less here, when development is done it is moving to a different host - which in theory it should be just a matter of an htaccess file and editing the config. Right?

Though if anyone has any suggestions about it working here I would be happy to hear them!

Thanks again.

#4
[eluser]meridimus[/eluser]
There are some things you should change for dreamhost support, I gave up though but it was something like adding a question mark on the end.

This was mine but it caused errors somewhere, I can't remember. Give it a go to find out.

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|lib|user_guide|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

#5
[eluser]nchmura[/eluser]
[quote author="meridimus" date="1232240958"]There are some things you should change for dreamhost support, I gave up though but it was something like adding a question mark on the end.

This was mine but it caused errors somewhere, I can't remember. Give it a go to find out.

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|lib|user_guide|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]
[/quote]

Yup, I tried that one too, though with all the little tweaks and whatnot I was trying, it might have been something else. I will give that try again when I am feeling up to it!

Thanks.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.