我在本地制作了一个codeigniter项目。然后我将它上传到我的域,但它唯一加载的是我的主页和我的数据库中的数据。导航不起作用,甚至是我主页的分页。
我上传之前一切正常。我也没有看到任何php错误。 “ERROR 404 - PAGE NOT FOUND”
您认为这是什么问题?
的config.php
$config['base_url'] = 'http://thegamerx.net/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
的.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
autoload.php
$autoload['packages'] = array();
$autoload['libraries'] = array('database','form_validation','pagination','session');
$autoload['helper'] = array('html','url','text','form','utility');
$autoload['config'] = array();
$autoload['language'] = array();
$autoload['model'] = array('blog_model');
答案 0 :(得分:1)
在config.php文件中设置基本URL,如
$config['base_url'] = 'http://your_domain_name_here';
答案 1 :(得分:0)
等等,您的网站使用www
前缀。您的配置可能包含www
。无论如何,添加重定向规则以重定向空白域可能会有所帮助。
RewriteCond %{HTTP_HOST} ^thegamerx.net
RewriteRule (.*) http://www.thegamerx.net/$1 [R=301,L]
小心301重定向,但它们是永久性的(浏览器和搜索引擎缓存它们)。您可能想尝试使用302以确保它在转到301之前有效。
答案 2 :(得分:0)
config.php(在配置文件夹中)
# DEVELOPMENT SERVER
$config['base_url'] = 'http://thegamerx.net';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
将此.htaccess放在您的根文件夹上,与应用程序文件夹,系统文件夹和index.php相同级别
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
</IfModule>
如果您可以访问我们的服务器配置(通常位于/etc/apache2/sites-available/your-site-config-file.conf下),请尝试设置以下内容:
<Directory /your/site/root/folder/>
AllowOverride All
Order allow,deny
Allow from all
</Directory>