Welcome Guest, Not a member yet? Register   Sign In
How to hide URL details
#1

[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
#2

[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
}




Theme © iAndrew 2016 - Forum software by © MyBB