confucius
confucius

Reputation: 13327

url codeigniter

I have a problem making a url in Codeigniter. The url is mywebsite.com/users/mike where mike is the parameter for method users. I want to delete the method users so the url becomes mywebsite.com/mike as in facebook.

Upvotes: 2

Views: 199

Answers (2)

Demian Brecht
Demian Brecht

Reputation: 21378

You want to use CI's routing capabilities, for example:

$route['([\w]+)'] = "users/$1";

Note: This may be a little tricky as you'll have to deal with routing to the other controller as well (you'll have to tailor the regex a little). I don't have CI installed to test it, so you'll definitely want to modify it.

Read more on CI routing here.

Upvotes: 4

meteorainer
meteorainer

Reputation: 952

I'm not 100% sure i understand what you are trying to do, but could you use mod_rewrite to prettify the urls? http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

Upvotes: 0

Related Questions