CodeIgniter Forums
Configure website not on the site root, eg https://website.org/ci4/ - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Configure website not on the site root, eg https://website.org/ci4/ (/showthread.php?tid=90313)



Configure website not on the site root, eg https://website.org/ci4/ - nerozero - 02-29-2024

Hello there,
I'm start learning Codeigniter framework and have some issues while testing website placed not as primary web, but in sub directory, eg https://website.org/ci4/
It is not clear to me how to proper make a configuration to address locale and routes. For example:

in ".env"
Code:
app.baseURL = 'https://website.org/ci4/'

in "app/Config/Routes.php"
PHP Code:
$routes->get'{locale}/test''Home::test' ); 


when accessing website using "en" locale, "https://website.org/ci4/en/test" I'm getting 404 error:
Code:
Can't find a route for 'get: ci4/en/test'.

Also I'm getting 404 error on "__hot-reload"

Code:
Can't find a route for 'get: ci4/__hot-reload'.



Thanks in advance



RE: Configure website not on the site root, eg https://website.org/ci4/ - nerozero - 02-29-2024

Ok, I guess I found my issue in ".htaccess"
Code:
Code:
# If you installed CodeIgniter in a subfolder, you will need to       
# change the following line to match the subfolder you need.         
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
RewriteBase /ci4                                                     
Thanks!