Hugo Rocha
Hugo Rocha

Reputation: 537

Codeigniter PHP - Redirect giving internal server error on real server

Adding error_reporting(E_ALL | E_WARNING | E_NOTICE); ini_set('display_errors', TRUE); Doesn't print anything.

Don't have access to the apache logs.

Pages controller:

<?php

class Pages extends CI_Controller {

    public function view($page = 'index')
    {

        if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
        {
            // Whoops, we don't have a page for that!
            show_404();
        }

        redirect('home', 'refresh');

    }
}
?>

Got a .htacces file with the following I tried to remove what was inside it still didn't work but i will put here anyway:

    RewriteEngine On
    RewriteBase /site/

    RewriteCond %{REQUEST_FILENAME} !/(application/views/templates/*/css|js|images/)/
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

Header set Access-Control-Allow-Origin "http://example.com"

My base url in the config is configured to the site url like

$config['base_url'] = 'http://example.com/';

Don't know what else to do, any help will be appreciated.

Thanks in advance,

Upvotes: 2

Views: 1857

Answers (1)

Hugo Rocha
Hugo Rocha

Reputation: 537

After a few days finally I found out the problem, kind of a stupid error, works fine if in the .htaccess file I replace the

RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

For

RewriteRule ^(.*)$ /index.php/$1 [L,QSA] 

Only the dot behind /index.php was causing the problem. Locally worked fine but in the server..

Thanks Jeremy for your help.

Upvotes: 5

Related Questions