In route file add this below line. That is as Profile is as controller and user is as method.
'$route['(:any)'] = 'profile/user/$1';
Thats all. :)
Question
I am doing a project on CI, And I wish the project should look like this www.twitter.com/username
. Here twitter
will be my project folder and username
should be get from database. How can I make it? Thanks in advance.
Solution 2
In route file add this below line. That is as Profile is as controller and user is as method.
'$route['(:any)'] = 'profile/user/$1';
Thats all. :)
OTHER TIPS
you should change the .htaccses file to remove the index.php from url like so:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
<Files "index.php">
AcceptPathInfo On
</Files>
then you need to remove the index.php from config.php file in the config folder like so:
$config['index_page'] = ''; //LEAVE EMPTY - NO INDEX.PHP
and then you can use the username in your default controller, but i still think you will need another mehtod before the username, because you cant pass a parameter to index method