![]() |
[SOLVED] index.php if base url redirect codeigniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: [SOLVED] index.php if base url redirect codeigniter (/showthread.php?tid=60845) |
[SOLVED] index.php if base url redirect codeigniter - El Forum - 07-11-2014 [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 Config/config.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); [SOLVED] index.php if base url redirect codeigniter - El Forum - 07-11-2014 [eluser]Tim Brownlaw[/eluser] Am I guessing correctly that you are wanting to achieve something like... 1. Check that the script has been installed. If the script has not been installed - then run the installer else - carry on as usual. [SOLVED] index.php if base url redirect codeigniter - El Forum - 07-11-2014 [eluser]riwakawd[/eluser] [quote author="Tim Brownlaw" date="1405065047"]Am I guessing correctly that you are wanting to achieve something like... 1. Check that the script has been installed. If the script has not been installed - then run the installer else - carry on as usual. [/quote] Yes some thing like that I use my_loader.php weather it could be put in there or on the index.php just not sure what and were to put it. [SOLVED] index.php if base url redirect codeigniter - El Forum - 07-11-2014 [eluser]joergy[/eluser] I'm using the following function. /start/fw is a part of the URI to my script, which i consider being unique below my DocumentRoot. Normally $_SERVER["PHP_SELF"] et. al. are considered as dangerous, but I don't build any output out of it, and I only make use the part of the path in front of my /start/fw (if You don't understand what I'm talking about, simply ignore my last sentence). Code: function get_base_url(){ [SOLVED] index.php if base url redirect codeigniter - El Forum - 07-11-2014 [eluser]CroNiX[/eluser] After a successful install, you could just create a file like install.dat that is empty at a specific location. Then in your index (I'd actually use a MY_Controller) you can just check to see if the file exists. If so, carry on. If not, redirect to the install controller. [SOLVED] index.php if base url redirect codeigniter - El Forum - 07-11-2014 [eluser]CroNiX[/eluser] Why not just create a route for your install? Then you wouldn't need to do most of that. You could just Code: if ( ! file_exists(install.dat)) |