CodeIgniter Forums
Redirect issue on new local project - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Redirect issue on new local project (/showthread.php?tid=78356)



Redirect issue on new local project - rcamino - 01-07-2021

Hi! I'm trying the last version of CI (CI4) but I'm getting any problems on the localhost installation.
The project is located in {XAMPP}/htdocs/ejemplo-ci
I've in App.php:

Code:
public $baseURL = 'http://localhost/ejemplo-ci/';
public $indexPage = 'index.php';

and the routes

Code:
$routes->get('/', 'Usuarios::index');
$routes->get('/registro', 'Usuarios::registro');

There isn't with the home page (references to index section con Usuarios controller) but
http://localhost/ejemplo-ci/registro send me to XAMPP Dashboard.
Can anybody help me?


RE: Redirect issue on new local project - berendbotje91 - 01-07-2021

For local development it is advised to use php built in web server. See http://codeigniter.com/user_guide/installation/running.html

On a server everything is served from the public folder and changed using 'mod_rewrite' (on an apache webserver). This requires setting the documentroot in apache to '<location>/ejemplo-ci/public/' (where location is wherever ejemplo-ci is located).

My guess is that your XAMPP installation might not have mod-rewrite on or have the DocumentRoot set up.


RE: Redirect issue on new local project - captain-sensible - 01-07-2021

i've also written this for those on slackware Linux : https://docs.slackware.com/howtos:misc:approach_to_web_development_on_slackware . It mentions permission problems and being able to have several dev apps towards end


RE: Redirect issue on new local project - rcamino - 01-08-2021

(01-07-2021, 05:16 AM)berendbotje91 Wrote: For local development it is advised to use php built in web server. See http://codeigniter.com/user_guide/installation/running.html

On a server everything is served from the public folder and changed using 'mod_rewrite' (on an apache webserver). This requires setting the documentroot in apache to '<location>/ejemplo-ci/public/' (where location is wherever ejemplo-ci is located).

My guess is that your XAMPP installation might not have mod-rewrite on or have the DocumentRoot set up.

Thank you! It worked, I found the guide very useful: now, I wonder what it will be like to put the project in production in an existing subfolder on a shared server.
Surely there is a guide for that ...


RE: Redirect issue on new local project - InsiteFX - 01-08-2021

PHP Code:
// change this
public $indexPage 'index.php';

// to this
public $indexPage ''

I had problems with xampp going to the dashboard before so now I just rename the
index.php file in the root with the htdocs folder.

But now I use VHOSTS


RE: Redirect issue on new local project - berendbotje91 - 01-11-2021

(01-08-2021, 04:21 AM)rcamino Wrote: Thank you! It worked, I found the guide very useful: now, I wonder what it will be like to put the project in production in an existing subfolder on a shared server.
Surely there is a guide for that ...

There might be a solution here: https://forum.codeigniter.com/thread-75908-page-2.html?highlight=shared+hosting if you want to keep using shared hosting. However, I can't test it myself since I host on a VPS myself.