CodeIgniter Forums
Ci4 on subfolder - 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: Ci4 on subfolder (/showthread.php?tid=78045)



Ci4 on subfolder - pippuccio76 - 11-24-2020

Hi , sorry for english , i installed a ci4 application on subfolder , set the base url and the base controller .
If i go to base url (www.domain.com/ci4) i redirected to the base controller (user) and because im not logged to the user/login ( www.domain.com/ci4/user/login ) . If i modify the url eliminating login im redirecting to www.domain.com/user with 404 page why ?


RE: Ci4 on subfolder - cseon - 11-24-2020

Hi, sorry for my english too !
For using ci4 in a subfolder I create a subdomain and modify the DNS to target the url I want.
After nothing special to do in ci4 installation.


RE: Ci4 on subfolder - InsiteFX - 11-24-2020

You need to set your new path locations.

See .app/Config/Paths.php


RE: Ci4 on subfolder - pippuccio76 - 11-25-2020

(11-24-2020, 06:55 PM)InsiteFX Wrote: You need to set your new path locations.

See .app/Config/Paths.php


this is my structure folder :

inside / 
-my_domain
-other domain

inside my_domain
-ci4

inside ci 4:
-assets
-codeigniter
-index.php

this is codeigniter:
-app
-system
-writable
-.env

Must i change config path ? it don't work if https://my_domain.com/ci4/user/login became https://my_domain.com/ci4/user/ the url became automatically https://my_domain.com/user  (without ci4).

if i see https://rxdental.resista-ds.it/ci4/ automatically became https://rxdental.resista-ds.it/ci4/user/login (because user it's the default controller login because im not autenticated)


RE: Ci4 on subfolder - InsiteFX - 11-25-2020

Your bas3e_url should be like this, I really don't understand why users keep move CodeIgniter
arround? You can keep the same structure and then just drop it in a sub folder and set the
base_url.

PHP Code:
// .app/Config/App.php
public $baseURL 'https://my_domain.com/ci4/'



RE: Ci4 on subfolder - includebeer - 11-25-2020

I had troubles in the past setting up CI4 in a subdirectory like you did. There was some bugs with the redirections, even if the baseURL is correctly configured. I highly recommend you set up a subdomain like ci4.mydomain.com instead of a subdirectory. It will save you some headaches!