I can access Controller but not method in it... |
[eluser]Ceros[/eluser]
Hi CI developpers, Ok, first I had probs with calling controller ex: http://localhost/MyProject/product/ won't work but putting the index.php in the URL work. Ive created a .htaccess file and now it's working. When I type my controler name, it call the index method. Now the problems is that I can't call other method. ex: http://localhost/MyProject/product/fobar even if i put product/index it's not working. I always get that "404 Page Not Found. The page you requested was not found." This is the CI 404 Page, not the one from Apache. I'm using Apache and PHP5. I tried different .htaccess file, AUTO, QUERY_STRING and everything else. Thanks for your help! Sebastien Dicaire
[eluser]GSV Sleeper Service[/eluser]
post your .htaccess, there could be a problem with that.
[eluser]Ceros[/eluser]
RewriteEngine On RewriteBase /MyProject RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] It's the one from the Wiki
[eluser]cahva[/eluser]
Try loosing the question mark in the "index.php?" Quote:RewriteRule ^(.*)$ index.php/$1 [L]
[eluser]Ceros[/eluser]
[quote author="cahva" date="1264625851"]Try loosing the question mark in the "index.php?" Quote:RewriteRule ^(.*)$ index.php/$1 [L][/quote] That didn't work. Here's my product controler: Code: class Produits_controller extends Controller { My routing: Code: $route['produits'] = "produits_controller"; http://localhost/LamexMVC/ -> Works http://localhost/LamexMVC/publique/index -> works (which is my default controller) http://localhost/LamexMVC/produits -> Works, call index http://localhost/LamexMVC/produits/index -> Not working http://localhost/LamexMVC/produits/insert -> Not working My htaccess: (Tried with and w/out the ?) Code: RewriteEngine On I tried to call a method in my default controller (Publique) http://localhost/LamexMVC/publique/test and it did work. I'm confused right now. It's working in my default controller but not in the other one? Thanks for your help
[eluser]Ceros[/eluser]
Ok apparently, I can't put _controller in the file name and in the class name... If I rename my controller: produits.php and Public class Produits, everything is working |
Welcome Guest, Not a member yet? Register Sign In |