Welcome Guest, Not a member yet? Register   Sign In
Issue with controller's parameters
#1

Hi everyone, this is my first post on this forum. I'm a french developper, so please excuse me for my english Tongue

I'm using Codeigniter 2 for a while on various projects, but this morning i tried to start a new project from scratch, with Codeigniter 3.

Everything was ok untill i decided ton add a simple parameter to one on my controller.

So i tried to reproduce the problem in a test project :

My routes.php :
Code:
$route['test'] = 'test_controller';
$route['test/(:any)'] = 'test_controller/$1';

My test_controller :
Code:
class test_controller extends CI_Controller {
    
    public function test($p) {
        
        echo 'toto';
        
    }
    
}

My base .htaccess (a very basic one that i use for developpement purposes, but works with CI-2) :

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

If i remove the $p parameter and access the page :

http://localhost/site_name/test/test/

I works fine.

But if i let the $p parameter and access this URL :

http://localhost/site_name/test/test/1

I get a 404 page not found error.

I also tried to do exactly the same test, on an CI 2 core, and it works fine !

I guess that the problem is into my .htaccess, but i don't understand why it work's in CI 2, but not in CI 3 ?

Does somebody has ever had this issue ?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB