CodeIgniter Forums
site_url() does not work with alternate config - 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: site_url() does not work with alternate config (/showthread.php?tid=76400)



site_url() does not work with alternate config - crustamet - 05-10-2020

Hello guys i have 2 projects.
1 Front 
1 Admin

i have 2 separate folders for each project so in first project i have this config
FRONT Base_url = http://example.com
ADMIN Base_url = http://example.com/admin

In admin i want to use a config to create links for the FRONT

So i am trying to use this site_url with the Alternate configuration File

PHP Code:
$config = new \Config\AppFront();

echo 
site_url('test',NULL$config); 

But it gives me the same URL for the admin
http://example.com/admin/test

Expected result
http://example.com/test

I have this Config File
PHP Code:
<?php namespace Config;

use 
CodeIgniter\Config\BaseConfig;

class 
FrontApp extends BaseConfig
{
    public 
$baseURL 'https://example.com/';

    public 
$indexPage '';

    public 
$uriProtocol 'REQUEST_URI';


Maybe this is a bug ? Or i am using this alternate config file wrong ?