我的codeigniter项目只加载主页,导航链接不起作用


My codeigniter project only loads the home page, the navigation links won't wok

我在本地创建了一个codeigniter项目。然后我把它上传到我的域名,但它加载的唯一东西是我的主页和数据库中的数据。导航不工作,甚至从我的主页分页。

上传之前一切正常。我也没看到任何php错误。" 404错误-未找到网页"

你认为问题是什么?

config。

$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');

在config.php文件中设置基础URL,如

$config['base_url'] = 'http://your_domain_name_here';

等等,您的站点可以使用www前缀。您可能已经配置了www。无论如何,添加一个重定向规则来重定向空白域可能会有所帮助。

RewriteCond %{HTTP_HOST} ^thegamerx.net
RewriteRule (.*) http://www.thegamerx.net/$1 [R=301,L]
但是要小心301重定向,它们是永久的(浏览器和搜索引擎会缓存它们)。在转到301之前,您可能需要尝试302以确保它可以正常工作。

Config .php (inside Config Folder)

# DEVELOPMENT SERVER
$config['base_url'] = 'http://thegamerx.net';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

把这个。htaccess放到你的根目录下,和application文件夹,system文件夹和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>