[eluser]riwakawd[/eluser]
On my index.php in codeigniter I am trying to find the best way to make the BASE_URL redirect to APPPATH . modules/install/step1.php if it has not done before
What would the best way for it for to work I have tried to !defined header location
How can I make it redirect on the index.php APPPATH . modules/install/step1.php if server has not been to the path set.
Top of the main index.php This code below just makes it easier so user does not have to enter base url.
Code:
<?php
if (isset($_SERVER['HTTP_HOST'])) {
$base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 'https' : 'http';
$base_url .= '://'. $_SERVER['HTTP_HOST'];
$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
} else {
// Back Up Url
$base_url = 'http://localhost/';
}
define('BASE_URL', $base_url);
unset($base_url);
Config/config.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = BASE_URL;
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';