CodeIgniter Forums
Url Rewriting problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Url Rewriting problem (/showthread.php?tid=26585)



Url Rewriting problem - El Forum - 01-18-2010

[eluser]Comelse[/eluser]
Hi,

I've got a simple controller looking like this :
Code:
class Expert extends Controller {

    public function __construct()
    {
        parent::Controller();    
        $this->load->file('include/top.php');
        $this->load->model('User_model', 'User');
    }
    
    public function index($pseudo)
    {
        echo $pseudo;
    }
}

And I want to have the url :
Code:
expert/index/toto
rewrited has
Code:
expert/toto

I've tried :
Code:
RewriteRule ^/expert/(.*)$ /expert/index/$1 [L]
Whitout success.

Is it possible ?

Thanks a lot


Url Rewriting problem - El Forum - 01-18-2010

[eluser]n0xie[/eluser]
Maybe take a look at URI routing


Url Rewriting problem - El Forum - 01-18-2010

[eluser]Comelse[/eluser]
Thanks for your help.

I've added the route :
Code:
$route['expert/:any'] = "expert/index/$1";

But my controller returns $1 instead of the value, like if it wasn't replaced correctly.
Do I need to activate something ?


Url Rewriting problem - El Forum - 01-18-2010

[eluser]n0xie[/eluser]
Try:

Code:
$route['expert/(:any)'] = "expert/index/$1";



Url Rewriting problem - El Forum - 01-18-2010

[eluser]Comelse[/eluser]
It works !
Thanks a lot


Url Rewriting problem - El Forum - 01-18-2010

[eluser]Unknown[/eluser]
hi may i know which framework is better either codeigniter or kohana


Url Rewriting problem - El Forum - 01-18-2010

[eluser]Sean Gates[/eluser]
Good luck @srilakshmi. I haven't found one. And I doubt anyone here will tell you that anything is better than CI.


Url Rewriting problem - El Forum - 01-18-2010

[eluser]Comelse[/eluser]
@srilakshmi: I don't know about Kohana, but CI just satisfies my needs and, as you can see, has a great community :-)