0

Here is my Php script redirect into admin page ...this code working fine in localhost but i will go the server is not redirected
i dont know ehy its happening right now ... any help guys...

if ($this->session->userdata('admin_login') == 1)
redirect(base_url() . 'index.php?admin/dashboard', 'refresh');

2
Contributors
6
Replies
40
Views
2 Years
Discussion Span
Last Post by infoitmanoj
0

Hi, there are two possible reasons:

  1. the url helper is not loaded
  2. missing trailing slash in application/config/config.php $config['base_url']:

    $config['base_url'] = 'http://domain.tld'; # <- missing final /
    
0

i can check my url its correct ...but my page cannot be redirected in admin dashboard ...but localhost it should be working fine ...

Edited by infoitmanoj

1

Ok then what happens to the page? Is it blank? Try to change the ENVIRONMENT to development that should show the errors, this can be set in the index.php page, otherwise check CI error log.

1

No, open the main index.php file, in the first lines, depending on the CodeIgniter version in use, you should see (for version 2.*):

define('ENVIRONMENT', 'development');

while, for version 3.*:

define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');

Be sure the value is development.

Note

With version 3.* it's possible to push a server environment variable to define the environment through the .htaccess file. For example:

SetEnvIf Host www.domain.tld$ CI_ENV=production

The same can be applied at server config, so if you're using CI 3.* be sure your hosting is not setting this by default. It can be overridden by replacing the define() with the CI 2.* version code string.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.