문제

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.

도움이 되었습니까?

해결책 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. :)

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top