a.noob.webdev
a.noob.webdev

Reputation: 33

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

I made a codeigniter project locally. Then I upload it to my domain, but the only thing it loads is my home page and data from my database. The navigation doesn't work, even the pagination from my home page.

Everything works before I uploaded it. I don't see any php errors too. "ERROR 404 - PAGE NOT FOUND"

What do you think is the problem?

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

Upvotes: 0

Views: 82

Answers (3)

Jeremy
Jeremy

Reputation: 2536

config.php (inside Config Folder)

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

Put this .htaccess on your very root folder, same level as application folder, system folder, and index.php

<IfModule mod_rewrite.c>
    RewriteEngine on 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule .* index.php/$0 [PT,L]
</IfModule>

If you have access to our server configuration (usually under /etc/apache2/sites-available/your-site-config-file.conf), try to set the following:

<Directory /your/site/root/folder/>
   AllowOverride All
   Order allow,deny
   Allow from all
</Directory>

Upvotes: 0

dakdad
dakdad

Reputation: 2955

Wait, your site works with the www prefix. You probably have your config with the www on it. Anyway, adding a redirect rule to redirect the blank domain might help.

RewriteCond %{HTTP_HOST} ^thegamerx.net
RewriteRule (.*) http://www.thegamerx.net/$1 [R=301,L]

Be careful of 301 redirects though, they are permanent (browsers and search engines cache them). You might want to try with a 302 to make sure it works before going to 301.

Upvotes: 0

Drop Shadow
Drop Shadow

Reputation: 808

Set your base URL in config.php file like

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

Upvotes: 1

Related Questions