這對我來說是一個新的。我將我在codeigniter中創建的網站轉移到godaddy共享託管服務器。我能到主頁用:共享託管服務器上使用codeigniter困惑
http://www.example.com
但是當我嘗試去其他頁面,如:
http://www.example.com/about-us/
它拋出我這個錯誤消息:
未找到
在此服務器上未找到請求的URL /example/index.php/about-us/。
此外,嘗試使用ErrorDocument處理請求時遇到404未找到錯誤。
如果我使用:
http://www.example.com/index.php/about-us/
的頁面出現像白天一樣清晰。
我已經查找了CI解決方法,但我的網站更多的是靜態頁面,然後是動態頁面。
總的來說,我的問題是,我做錯了什麼,這是否有一個與godaddy共享託管帳戶有什麼關係?
的.htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
CI配置文件
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'QUERY_STRING';
CI自動加載的文件
$autoload['helper'] = array('url');
2011年9月30日更新:
在.htaccess使用:
# Options
Options -Multiviews
Options +FollowSymLinks
#Enable mod rewrite
RewriteEngine On
#the location of the root of your site
#if writing for subdirectories, you would enter /subdirectory
RewriteBase/
#Removes access to CodeIgniter system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css
#folders, and the robots.txt file
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php?/$1 [L]
在CI配置文件:
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
來源:codeigniter.com/wiki/Godaddy_Installaton_Tips
不要把「解決」,或在標題或類似的問題。請將您的解決方案作爲下面的答案發布。謝謝。 – Sparky