CodeIgniter Install Problem
-
05-09-2019 - |
Question
I'm having a problem getting CodeIgniter to work on my shared hosting account. The URL is http://test.tallgreentree.com. It's not giving me a .php error, but it is displaying a 404 page for everything I type into the address bar.
Here's the beginning of my config.php file.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
*/
$config['base_url'] = "http://test.tallgreentree.com/";
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = "index.php";
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of "AUTO" works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO' Default - auto detects
| 'PATH_INFO' Uses the PATH_INFO
| 'QUERY_STRING' Uses the QUERY_STRING
| 'REQUEST_URI' Uses the REQUEST_URI
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol'] = "AUTO";
Are there known issues when using CodeIgniter with subdomains? What could be causing this? I've tried multiple configurations, but nothing seems to be working for me. What server settings should I check with my hosting provider?
Thank you all for your time and assistance.
Solution
change
$config['uri_protocol'] = "AUTO";
to
$config['uri_protocol'] = "REQUEST_URI"
and see if that fixes it
also, do you have the class controller name the same as the file name?
filename = test.php
class Test ...
OTHER TIPS
Make 2 Changes in config.php file
First one is:
`$config['uri_protocol'] = "AUTO";`
to
`$config['uri_protocol'] = "REQUEST_URI"`
Second one is:
$config['index_page'] = 'index.php';
to
$config['index_page'] = 'index.php?';
I got this working with "REQUEST_URI" but then I can only hit my home page. All the other links (to the controller) always refreshes to the home page. It's kind of weird that it shows the correct URL but takes you to the home page no matter what URL you click.
Any ideas? I do have a .htaccess file,
RewriteEngine on RewriteBase /testci RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.)$ /index.php/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.)$ index.php/$1 [L] RewriteCond $1 !^(index.php|images|captcha|css|js|robots.txt) addType text/css .css