0

In CodeIgniter, my url someurl.com/test/ will not execute anything inside the controller class. Please take a look and tell me if there's something you can think of that might prevent the execution of the CI_Controller here or where I should look.

For example the following

some.testurl.com/test/hi/Bob
some.testurl.com/test
some.testurl.com/test/hi

all show:

Above class
Below class

EDIT: I believe my issue is with how I'm trying to run two separate applications. One is at testurl.com and the other is some.testurl.com where the directory for some.testurl.com is a subfolder of the directory where testurl.com is held. What's the right way to do this that they both work?

Update: Moving the subdomain outside the other CodeIgniter application's directory hasn't changed the behavior in any way. The CodeIgniter controller does not do anything.

Here's my code:

<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');

    echo "Above class<br>";

    class Test extends CI_Controller {
    public function __construct() {
        parent::__construct();
        $this->load->model('mod_login');
        $this->load->helper('date');

        }
//443 replace with 482
    function index() {
        echo "Index function";
    }

    function hi($name)
    {
        echo "Hi".$name."!";
    }
}

echo "Below class<br>";
?>

Here's my .htaccess file:

RewriteEngine on
RewriteCond $1 !^(index\.php|assets|common|ico|database_backup|images|img|js|scripts|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
  1. Error reporting is enabled already and no errors are triggered. Environment is defined as development on the index file.
3
  • 1
    Your controller file is fine .I am guessing you might have errors either on helper file or model file. check those files too. You can enable error reporting and check for errors. Commented Aug 31, 2015 at 3:37
  • 1
    Is this working someurl.com/index.php/test/ ? Commented Aug 31, 2015 at 4:16
  • Hi Bugfixer. When I try that I get a CI generated 404 error. Commented Aug 31, 2015 at 17:19

2 Answers 2

1

This may be a mod_rewrite issue. Check your php info to see if the module is installed and running on the apache server.

If there is, check you httpd.conf file at <Directory "C:/PATH/TO/YOUR/APP"> directive, where it should exist AllowOverride All.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the time, but mod_rewrite is already working fine.
0

A missing curly bracket in database.php broke the whole application without triggering an error message. I'm sorry because no one could ever guess it. It's not the type of error I expected to cause this problem because I verified that environment was development and I triggered lots of other errors in my quest to fix this.

If someone else runs into this, just know it could be a simple error in any of the config files.

Thanks everyone.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.