2012-03-29 9 views

答えて

7

そのシンプルな、CodeIgniterのルーター

$route['articles/([0-9]+)'] = "controller_name/article/$1"; 

でそして、あなたのコントローラに

http://mysite.com/article/id 

をルーティングする強力なURLを持って

public function article($id) { 
    //here your article id 
    echo $id; 
} 

また、すべての組み合わせをindex.phpに転送するために.htaccessにURL転送が必要です。

RewriteEngine On 
Options -Indexes 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
関連する問題