2014-08-27 43 views
-2

我有CodeIgniter和mod_rewrite模塊的問題。 在Apache中,我遵循了我在ellislab博客中找到的所有指令。所以刪除index.php也起作用。現在我有這個文件的.htaccess:Codeigniter和mod_rewrite,重寫不工作,404錯誤

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteBase/
    #RewriteRule ^box/$ create/$1 # Handle requests for "pet-care" 
    RewriteRule ^about/$ aboutus 
    RewriteRule ^(.*)$ index.php?/$1 [L,QSA] 


</IfModule> 

<IfModule !mod_rewrite.c> 
    # In caso di mancanza di installazione del modulo mod_rewrite, 
    # tutte le pagine 404 possono essere inviate ad index.php 
    # e tutto funzionera' normalmente 

    ErrorDocument 404 /index.php 
</IfModule> 

我不能去工作的事情是行

#RewriteRule ^about/$ aboutus 

我要重寫我的本地/關於我們在本地主機/左右。我有一個名爲aboutus的控制器,它指的是一個關於us的視圖。
另一個問題是,當我有一個URL結構是這樣的:

localhost/controller/function/param1/param2 

,我想在轉換:

localhost/myname/param1 

不能弄明白:(

+0

你應該用戶'配置/ route.php'路由這種類型的'uri'更多信息的https:/ /ellislab.com/codeigniter/user-guide/general/routing.html – Girish 2014-08-27 08:58:11

+0

謝謝,這工作得很好! :) – 2014-08-27 09:54:56

回答