CodeIngiter redirect error

codeigniter show error
codeigniter error handling example
how to generate error log file in codeigniter
codeigniter, database error handling
show error message in codeigniter
codeigniter debug log
$this- db- error() codeigniter
hide database error codeigniter

Hi everyone I've been working on a simple php back end based on codeigniter v3. i developed it on cloud 9 ide, then i have migrated it on a website hosting.

i changed db configuration file and

$config['base_url'] = 'codeigniterfolder/';


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

my problem is about tha the default controller is property loaded but when i go to another controller it show me file not found , but no errors from codeigniter, simply file not found without 404 error.. can enyone help me ?

You can try this:

// server base url
$config['base_url'] = '';

// localhost base url
$config['base_url'] = 'http://localhost/project_floder_name/'; //

<IfModule mod_rewrite.c>

    RewriteEngine On
    RewriteBase /
    Options -Indexes

    RewriteCond %{REQUEST_URI} ^system.*

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

    RewriteCond %{REQUEST_URI} ^application.*

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

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

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


<IfModule !mod_rewrite.c>

    ErrorDocument 404 /index.php


Error Handling, CodeIgniter builds error reporting into your system through Exceptions, both the SPL collection, ConfigException; DatabaseException; RedirectException  CodeIgniter provides an easy error handling mechanism. You would like the messages to be displayed, when the application is in developing mode rather than in production mode as the error messages can be solved easily at the developing stage. The environment of your application can be changed, by changing the line given below from index.php file.

In config/config.php

We can do Dynamic Base Url

$config['base_url'] = '';
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://" . $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);

Error redirect from hook to another controller, I want redirect user in login page if is not logged my hook HK_Login.php inside application/hooks. Code: <?php class HK_Login { private $CI; CodeIgniter 3 Routes Tutorial - URI Routing - Duration: 13:46. RakibTG 32,157 views

In Config File

$config['base_url'] = '';
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://" . $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);

In Header view File or Common View Add Base Tag below the title and print the Base Url

<title>Website Title</title>

<base href="<?php echo base_url();?>">

Error Handling, In addition, it has an error logging class that permits error and debugging messages to be saved as text files. Note. By default, CodeIgniter displays all PHP errors. The problem. In CodeIgniter, when you process a form submission at the same path as the one showing the form, you can easily output the confirmation message. In the respective Controller method, before loading the form View, you can check for and process the POST data and depending on the result, pass along a confirmation message in a variable.

I had same issue today here is the solution for this problem:

  1. go to /etc/apache2/sites-available/000-default.conf on your vps; server
  2. add following code in <VirtualHost> tag. I suggest to add at the end.

<Directory /var/www/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted

Codeigniter page redirect not working - PHP, class FirstController extends CI_Controller { public function __construct() { parent​:: __construct(); $this->load->helper('url'); //avoid php error  The redirect function loads a local URI specified in the first parameter of the function call and built using the options specified in your config file. The second parameter allows the developer to use different HTTP commands to perform the redirect "location" or "refresh".

Just change your .htaccess file last line.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

CodeIgniter - Page Redirection, CodeIgniter - Page Redirection - While building web application, we often need to redirect the user from one page to another page. CodeIgniter makes this job  CodeIgniter logs error messages, according to the settings in app/Config/Logger.php. You can adjust the error threshold to see more or fewer messages. The default configuration has daily log files stored in writable/logs. It would be a good idea to check them if things aren’t working the way you expect!

CodeIgniter - Flashdata, CodeIgniter - Flashdata - While building web application, we need to store some For example, to display some error message or information message. //add flash data $this->session->set_flashdata('item','item-value'); //redirect to home  Due to security issues of blindly trusting the HTTP_REFERER system variable, CodeIgniter will store previously visited pages in the session if it’s available. This ensures that we always use a known and trusted source. If the session hasn’t been loaded, or is otherwise unavailable, then a sanitized version of HTTP_REFERER will be used.

when using CodeIgniter redirect() method with the 'refresh', when using CodeIgniter redirect() method with the 'refresh' parameter, mode_pagespeed causes a blank page - i.e. it doesn't follow the redirect. #521. Closed. Tag: javascript,php,jquery,codeigniter. I am trying to redirect to a particular page using the below code: Why am getting this error?: Unknown column 'firstname

Issues with redirects, Describe the bug There are two issues with the redirect() method. I am not namespace App\Controllers; use CodeIgniter\Controller; class Home extends refUrl; redirect($redirect_to_url); exit; /* Failes with this error below  CodeIgniter 4 redirect function not working. After logout, I tried to redirect for the home page. I tried to few ways, but not redirected. “Missing Temporary

  • $config['base_url'] is the URL of your website NOT the folder you are using. Example: $config['base_url'] = '';
  • Sorry I wrote something wrong in the question, I have set as base URL mydomain/codeigniterfolder
  • Do you have files with camelcase names?
  • The only one file is a controller called User. php
  • But when I run it on c9 it woked