使用codeigniter共享托管服务器上的困惑

使用codeigniter共享托管服务器上的困惑

本文介绍了使用codeigniter共享托管服务器上的困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这的人一个新的我。我传递一个网站,我取得了codeigniter到GoDaddy的共享主机服务器。我可以到首页有:

This ones a new on me. I'm transferring a site I made in codeigniter to a godaddy shared hosting server. I can get to the home page with:

http://www.example.com

但是,当我尝试去到另一个页面,如:

But when I try to go to the other pages like:

http://www.example.com/about-us/

这引发了我这个错误信息:

It throws me this error message:

未找到

所请求的网址/example/index.php/about-us/在此服务器上找到。

The requested URL /example/index.php/about-us/ was not found on this server.

此外,一个404 Not Found错误,而试图使用ErrorDocument来处理请求时遇到。

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

如果我使用:

http://www.example.com/index.php/about-us/

该页面出现像白昼一样。

The page appears as clear as day.

我已经看过了CI解决办法,但我的网站更多的是静态页面,然后动态页面。

I have looked up CI workaround , but my site is more of static pages then dynamic pages.

总的来说,我的问题是,我在做什么错的,这是否有什么关系有一个GoDaddy的共享托管帐户?

Overall, my question is, what am I doing wrong and does this have anything to do with having a godaddy shared hosting account?

的.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:

In the .htaccess use:

# 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 /维基/ Godaddy_Installaton_Tips

推荐答案

这是一个.htaccess的问题。试着改变你的.htaccess文件:

It's an .htaccess issue. Try changing your .htaccess file to:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]

这篇关于使用codeigniter共享托管服务器上的困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 15:20