Url在重定向时更改codeigniter

I am new in codeigniter.

I was trying to develop login page and its almost done but i do not know when i am trying to redirect page after successful login or redirecting after not successful login, the starting part of url localhost:81 changes to [::1]. I do not know why its happening i google it but i did not get proper way so please some one help me below i have mention my code.

Thank you in advance.


this is the controller code to verify Email and password

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

class verifyLogin_controller extends CI_Controller {

function _construct(){
    parent::_construct();       
}

public function index()
{       

    if($_POST["submitLogin"])
    {
        $userEmail=$this->input->post('email');
        $password=$this->input->post('password');

        $verify_query = $this->db->from("admin");           
        $verify_query = $this->db->where(array("admin_userid" => $userEmail,"admin_password"=>$password));
        $verify_query = $this->db->limit(1);
        $res=$this->db->get()->result();            
        if($res != null)
        {

            redirect("homeHeader_controller/index");

        }
        else
        {

            redirect("adminLogin_controller/index");

        }

    }
}
}

Set your base_url:

$config['base_url'] = 'http://localhost:81/';

Just try to add this code:

$ark_root  = "http://".$_SERVER['HTTP_HOST'];
$ark_root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = $ark_root;