Welcome Guest, Not a member yet? Register   Sign In
To many redirect
#1

Hi, i do normally not work with Codelgniter... I moved a website from a host to Strato, with Fillezilla i downloaded the ftp and uploaded it to the Strato host page. When opening the website i get the message; To many redirects... 
Help!
Reply
#2

Your question is not clear
Reply
#3

Check your base_url,
Check your Router,
Check your Controller - method for the home page.

If you have no idea about CodeIgniter or any of the things I have written above please read some tutorials on internet. Plus, you should also check your version. Is it CodeIgniter 3 or 2 or maybe the latest one: 4 ?

Or find someone who can check your system for you.
Reply
#4

Also, make sure the ftp copy didn’t missed the .htaccess file. Depending of the settings of your ftp software, it may be hidden. It will not work if it’s missing.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#5

Hi thanks for the replys. 
Htacces file is uploaded. 

Just to be a bit more clearer about my question; 
I want to move the website from one host to another host. From the old host i downloaded the ftp with filezilla. Then i uploaded the whole file to the new host with filezilla. 
I changed the database file in the config to the database information from the new host. 

If i try to open the website now i get the message; ...redirected you too many times.
Reply
#6

Can you please paste here your home or index method in your controller ?
And also router please. If you can provide some code samples here, we will have a chance to diagnose it directly.
Reply
#7

oke, i found out the website is build with CodeIgniter 3.1.4
Where can i find the "home or index method in the controller"? And also in which folder the router... In whitch folder?
sorry new to PHP...appreciate al the help!!! Smile
Reply
#8

(12-28-2020, 02:45 AM)demyr Wrote: Can you please paste here your home or index method in your controller ?
And also router please. If you can provide some code samples here, we will have a chance to diagnose it directly.
BELOW THE CODE OUT  MY CONTROLLER - i am new to php, so i do not know which part of the code is needed...  

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

/**
* Class Frontend_Controller
*/
class Frontend_Controller extends MX_Controller
{
    public $settings;

    /**
    * Frontend_Controller constructor.
    */
    public function __construct()
    {
        parent::__construct();

        $this->load->model("pages/pages_model");

        $this->init();
    }

    public function init()
    {
        $this->config->set_item('base_url', '/');

        $config = [
            'paths' => ['./application/modules/', VIEWPATH],
        ];
        $this->load->library('twig', $config);

        // Blog instellingen ophalen
        $this->load->model("blog/blogsettings_model", "blogsettings_model");
        $blog_page = $this->pages_model->get($this->blogsettings_model->get()["id_page"]);
        $this->settings["blog"]["page"] = $blog_page;

        // Maand namen bepalen
        $this->months = ["", "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"];
    }

    /**
    * @param $tpl
    * @param array $args
    */
    public function tpl($tpl, $args = [])
    {
        $args["is_admin"] = $this->session->userdata("hash") ? 1 : 0;
        $args["settings"] = $this->settings;
        $args["base_url"] = '/';
        $args['copy_date']  = date('Y');

        echo $this->twig->render($tpl, $args);
    }
}

/**
* Class Backend_Controller
*/
class Backend_Controller extends MX_Controller
{
    /**
    * Backend_Controller constructor.
    */
    public function __construct()
    {
        parent::__construct();

        $this->init();
    }

    /**
    *
    */
    public function init()
    {
        $this->load->model("administrators/administrators_model");

        $this->config->set_item('base_url','/admin');

        $this->authorised();

        $config = [
            'paths' => ['./application/modules/', VIEWPATH],
        ];
        $this->load->library('twig', $config);
    }

    /**
    * @param $tpl
    * @param array $args
    */
    public function tpl($tpl, $args = [])
    {
        $args["base_url"] = '/';

        echo $this->twig->render($tpl, $args);
    }

    /**
    *
    */
    public function authorised()
    {
        $administrator = $this->administrators_model->get_by_hash($this->session->userdata("hash"));

        if ((! $this->session->userdata("hash") && $this->uri->segment("2") != "authorised")
            || $this->session->userdata("hash") && ! $administrator["id"] && $this->uri->segment("2") != "authorised") {

            redirect("authorised");
        }
    }
}


BELOW THE CODE OUT MY ROUTER

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

/* load the MX_Router class */
require APPPATH."third_party/MX/Router.php";

class MY_Router extends MX_Router {}
Reply
#9

Tou should check code
Reply
#10

Check check project session array variables which variable use for check valid user that variable does not exist in this session array that's why it cause that's the problem (too-many-redirects). Check it's your session array or other variables.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB