Welcome Guest, Not a member yet? Register   Sign In
HOW TO CREATE URL AFTER DOMAIN AS USERNAME LIKE www.example.com/username
#1

[eluser]johanriyan[/eluser]
hello guys,

i want to create url like this :
www.example.com/username

how to handle controller, model and view.

thks guys
#2

[eluser]plain jane[/eluser]
You mean to say you want to remove index.php from the URL?
#3

[eluser]johanriyan[/eluser]
thks for respons.
but this problem has solved it.

i use routes like this :
Code:
$route['user/(:any)'] = "user/view";

$route['(:any)'] = "user/view";
#4

[eluser]sv3tli0[/eluser]
Code:
$route['(:any)'] = "user/view/$1";
Is correct way to catch the username..

How ever there is one big problem when you want to put such (:any) route..
You lose all normal routes ( /controller/method ) because all are going to user/view..
So you need to write in as routes all pages your site has before that :any..

It may be easier if you set a few type of pages with prefix forbidden for username ..
So "/settings" will load all settings page and etc..
This is the same way as Facebook routes work.
#5

[eluser]johanriyan[/eluser]
yes i want ulr as facebook.
thanks sv3tli0.






Theme © iAndrew 2016 - Forum software by © MyBB