Welcome Guest, Not a member yet? Register   Sign In
how to make URL friendly like http://mywebsite/username
#11

[eluser]CroNiX[/eluser]
Code:
$route['(:any)'] = 'users/viewprofile/$1';

Then in users, your viewprofile should look like

Code:
public function viewprofile($username = '')  //$username is being passed as the $1 in the route
{
  echo $username;
}
#12

[eluser]Linh Pham[/eluser]
[quote author="CroNiX" date="1334282323"]
Code:
$route['(:any)'] = 'users/viewprofile/$1';

Then in users, your viewprofile should look like

Code:
public function viewprofile($username = '')  //$username is being passed as the $1 in the route
{
  echo $username;
}
[/quote]
your way it works but occur a problem :
my login page : http://domainname.com/users/login , type this url onto address, it calls method viewprofile,
cant access to login page

a few pages like that
#13

[eluser]Linh Pham[/eluser]
[quote author="Linh Pham" date="1334282907"][quote author="CroNiX" date="1334282323"]
Code:
$route['(:any)'] = 'users/viewprofile/$1';

Then in users, your viewprofile should look like

Code:
public function viewprofile($username = '')  //$username is being passed as the $1 in the route
{
  echo $username;
}
[/quote]
your way it works but occur a problem :
my login page : http://domainname.com/users/login , type this url onto address, it calls method viewprofile,
cant access to login page

a few pages like that[/quote]

oh i do this
$route['users/login'] = "users/login";
and i works fine
thank you for supporting me
#14

[eluser]Mantero[/eluser]
this is call Vanity URL

here's the solution

http://ellislab.com/forums/viewthread/139195/#685983




Theme © iAndrew 2016 - Forum software by © MyBB