更新, 我在Ubuntu服務器上部署codeigniter項目時出現了一些問題,當我點擊鏈接時,出現404 Apache錯誤。如何爲apache服務器設置codeigniter?
當我把項目放在http://roy.my-domain.com/ =/var/www/html /文件夾中時,它的工作正常 - 但是當我添加子目錄http://roy.my-domain.com/roy/ =/var/www/html/roy /時,我得到了404錯誤。
當我的網址是http://roy.my-domain.com/roy/index.php/about - 我得到codeigniter 404錯誤,而不是apache2。
錯誤:
未找到
請求的URL的index.php在此服務器上找到。
的Apache/2.4.18(Ubuntu的)在roy.my-domain.com端口80
這裏服務器是我的設置:
0。在Apache中檢查重寫mod - 得到「模塊重寫已啓用」
1。 我的項目在/ var/www/my-project/
2。 在包含以下內容: 應用 系統 的public_html 的index.php htaccess的
.htaccess文件:
< IfModule mod_rewrite.c > RewriteEngine On RewriteBase/html/my-project/ RewriteCond%{REQUEST_FILENAME}!-f RewriteCond%{REQUEST_FILENAME}! -d
#重寫所有其他URL的index.php/URL重寫規則 ^(。*)$的index.php?URL = $ 1 [PT,L]
</IfModule>配置 < IfModule!mod_rewrite的.C> 的ErrorDocument 404的index.php </IfModule>配置
Apache2的。CONF:
<目錄/ var/WWW /> 選項指標的FollowSymLinks 要求所有授予 < /目錄>
<目錄/ var/www/html等/> 選項指標的FollowSymLinks 的AllowOverride所有 要求全部授予 </Directory>
config.php:
$ config ['base_url'] ='http://roy.my-domain/my-project/'; $ config ['index_page'] =''; $ config ['uri_protocol'] ='AUTO';
在index.php:
$ system_path = '系統'(不../system和../application工作); $ application_folder ='application';
的控制器:
(笨默認視圖)的welcome.php About_Controller.php
的觀點: (笨默認視圖)welcome_message.php about.php
本地 - 一切正常。 ..Thanks
您能否提供Apache錯誤日誌? – Viktor
嗨,感謝 - 從Apache服務器沒有錯誤 - 我無法查看除主頁以外的任何頁面 - 當點擊鏈接 - 我得到'頁面無法顯示'錯誤 – RoyBarOn
Viktor - 我已經設置$ config [' index_page'] ='';現在我得到一個錯誤 - 我更新我的帖子與錯誤內容 – RoyBarOn