CodeIgniter - Live site仅加载默认控制器的索引方法

I have been developing a CodeIgniter app in XAMPP on Windows 7. The app functions as expected locally but when uploaded it doesn't.

The default controller (ShowStadium) has the following methods: - index() - show()

index is loaded fine when called via the basepath, but neither loads when called directly:

/pathToApp/ShowStadium/ or /pathToApp/ShowStadium/index or pathToApp/ShowStadium/show

The error received is the Codeigniter 404 message.

The codeigniter instance is currently located in 2 subfolders. My .htaccess file:

RewriteEngine On

# Put your installation directory here:
# If your URL is www.example.com/, use /
# If your URL is www.example.com/site_folder/, use /site_folder/

RewriteBase /proj/groundtweet/

# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# For reuests that are not actual files or directories,
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]

Things I have tried:

  • The controller files are all lower case.
  • The base path is correct both installations.
  • Tried the various uri_protocol options
  • index.php has been removed from the path.

Any help would be appreciated, because I can't find an answer to this problem specifically and it's frustrating in it's probable simplicity.

Apologies if I've missed any details here.

Thanks.

Thanks for all the answers, in the end it was a matter of case sensitivity.

The controller filename was lowercase (showstadium.php) but referred to in form actions in Pascal case (ShowStadium).

It seems that for the default controller/action, CodeIgniter works around this (I haven't had a look at the guts, so I'm just making an assumption here) but when called directly the filename must match the url case - on the linux server.

try this below code, paste this in .htaccess file. place this file under the project folder if your project folder is groundtweet. paste the file under this folder.

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /proj/groundtweet/index.php/$1 [L]

i hope this will help you..

Go to application/config/config.php and change the

$config['uri_protocol'] = 'AUTO';

with the one of the following options (they are commented over this config):

 '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

one of these should work fine for you