Ubuntu 14.04 - Apache - PHP CI - was not found on this server - apache mod_rewrite won't work with codeigniter htaccess

摘要:Ubuntu 14.04 - Apache - PHP CI - was not found on this server - apache mod_rewrite won't work with codeigniter htaccess

遇到的這個問題可神了。

裝了Ubuntu 14.04.2 LTS 後,

灌了apache 

又灌了PHP

又改了/var/www/權限

把 PHP CI  程式放在/var/www/html裡面

執行192.168.2.xxx/project

可行,但跳轉另一頁,192.168.2.xxx/project/xxxx/xxxx 後,就出錯了。

出現

request URL xxxxx was not found on this server

 

查來查去,覺得找不到問題,

感覺一絲絲曙光就在,

是不是有使用移除index.php,.htaccess 那種 rewrite 的動作。

立即google /var/www/html ubuntu apache 

馬上找到一篇文章

Ubuntu 14.04 apache mod_rewrite won't work with codeigniter htaccess

https://www.digitalocean.com/community/questions/ubuntu-14-04-apache-mod_rewrite-won-t-work-with-codeigniter-htaccess

 

才發現,預設沒有啟用mode_rewrite

下了指令


sudo a2enmod rewrite

然後修改

sudo vi /apache2.conf

加入他說的<Directory>,但我加上了專案路徑/html/project/


<Directory /var/www/html/project>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
 </Directory>

sudo /etc/init.d/apache2 restart

成功了。