CodeIgniter Forums
404 on controller with query string - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: 404 on controller with query string (/showthread.php?tid=42192)



404 on controller with query string - El Forum - 05-29-2011

[eluser]mrmuggles[/eluser]
I developed a website with CI on my computer (Windows/Apache) and it’s working fine. (PHP/5.3.1 and CI 1.7.2)

I migrated to a php 5.3.6 Linux/Apache server.

When I call a controller with a query string, it shows a 404 on the new server.

But it works with a controller at the ROOT of the "controller" folder, but not inside a folder.

Code of my controller :

Code:
<?php

    class Test extends MY_Controller {
        
        function Test()
        {
            parent::Controller();
        }
        
        function _remap()
        {            
            $qs = $this->input->get('test');
            $message = "test:" . $qs;
            $this->load->view('ajax/message', array("message" => $message));
        }
    }
    
?>


My .htaccess :

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|js|css|phpMyAdmin|captcha|img_crop|user_guide)
RewriteRule ^(.*)$ /index.php/$1 [L]

In config.php :
$config['uri_protocol'] = "AUTO";
$config['enable_query_strings'] = TRUE;

If I call /test/test it works
If I call /test/test? it works
If I call /test/test?abc gives a 404


I read there http://stackoverflow.com/questions/2894250/how-to-make-codeigniter-accept-query-string-urls that you need to put PATH_INFO for uri_protocol, but if I do, only the default controller is called...

Any idea?


404 on controller with query string - El Forum - 05-29-2011

[eluser]mrmuggles[/eluser]
I changed $config[‘uri_protocol’] = “AUTO”; in config.ini for
$config['uri_protocol'] = "ORIG_PATH_INFO";
and it works... go figure :|


404 on controller with query string - El Forum - 06-02-2011

[eluser]marjune[/eluser]
try to lowercase your controller name!


404 on controller with query string - El Forum - 06-02-2011

[eluser]John_Betong_002[/eluser]
Try this:

./application/config/config.php
Code:
// set to maximum
  $config['log_threshold']  = 4;

  // your log file will appear here
  $config['log_path'] = getcwd() .'/' .APPPATH;
 
Run your application and check the log file for errors and warnings.

Don't forget to reset the config file.
 
 
 


404 on controller with query string - El Forum - 06-02-2011

[eluser]InsiteFX[/eluser]
Try adding the ? to your htaccess file and remove the first /
Code:
RewriteRule ^(.*)$ index.php?/$1 [L]

InsiteFX