这对我来说是一个新的。我将我在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