CodeIgniter配置虛擬路徑時找不到控制器的修改方法

使用Apache配置虛擬路徑時需要打開重寫的控制開關

  1. <Directory "D:\Project\support"> 
  2.      Options Indexes FollowSymlinks MultiViews 
  3.      AllowOverride All 
  4.      Order allow,deny 
  5.      Allow from All 
  6. </Directory> 
  7.  
  8. Alias /support "D:\Project\support" 

AllowOverride 默認爲None,需要改爲:All,表示允許所有重寫。

修改虛擬路徑下面的.htaccess配置文件 

  1. RewriteEngine on 
  2. RewriteCond $1 !^(index\.php|css|js|images|assets|uploads|sitebuild|res|temp|images|robots\.txt) 
  3. RewriteRule ^(.*)$ /support/index.php/$1 [L] 

在index.php/$1前面加上虛擬路徑,如/support/

config.php裏面的$config['index_page']可以不用修改。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章