![]() |
How to hide URL details - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How to hide URL details (/showthread.php?tid=40181) |
How to hide URL details - El Forum - 03-31-2011 [eluser]JasmineFlower[/eluser] Hi, I creating a project like blog. In my project i need to view blog. In Address bar, the URL displayed like this ..... http://www.domain.com/blog/view_blog/username/blog_name.... but, I need URL .... http://www.domain.com/username/blog_name.... How to hide the controller name-- blog & method name -- view_blog Is there any possible to hide OR any other way? pls any one tell me How to hide URL details - El Forum - 04-01-2011 [eluser]ebuoe[/eluser] what you need is the route config .. go to your config folder ,you will see the route file open it and set the following rules $route['(:any)/(:any)'] = "blog/view_blog/username/blog_name"; the 1st any will represent the username and the second will be for the blog_name to retrieve them in your controller use function view_blog() { $user_name = $this->uri->segment(1); $blog_name = $this->uri->segment(2); //you can now use the variables as you wish , note you should also set route rules for other pages on the site so taht they don't intefer with the any variable } |