How to set dynamic url in Codeigniter 4? |
03-14-2023, 11:34 AM
(This post was last modified: 03-14-2023, 11:37 AM by cijagani. Edit Reason: formating )
Q : how to set dynamic url in Codeigniter 4 ?
let's assume that i have following informations / configurations are ready one domain : ci4multitenant.local pointing to /var/www/html/myproject/public i have 2 subdomains branch1.ci4multitenant.local pointing to /var/www/html/myproject/public branch2.ci4multitenant.local pointing to /var/www/html/myproject/public configuration of .env file is here https://prnt.sc/2xsEA3pgBV7B when i open ci4multitenant.local in browser debug bar works fine but when i visit branch1.ci4multitenent.local or branch2.multitenant.local debugbar is not working / showing. is there any way to set baseURL dynamically? (03-14-2023, 11:34 AM)cijagani Wrote: Q : how to set dynamic url in Codeigniter 4 ?
Setting Dynamic base URL in CodeIgniter 4.0.2
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(03-15-2023, 12:18 AM)InsiteFX Wrote: Setting Dynamic base URL in CodeIgniter 4.0.2 i created Filter to set dynamic base url Filter name : VerifyTenant here is snippet and screenshot of Filter.php Code: public function before(RequestInterface $request, $arguments = null){ it seems working fine. but debugbar is not loading when you access subdomains. (03-14-2023, 08:41 PM)startup Wrote:(03-14-2023, 11:34 AM)cijagani Wrote: Q : how to set dynamic url in Codeigniter 4 ? already created
Finally i managed it by using Registrar.php
would like to share code here. PHP Code: <?php
@cijagani If you modify the URI object, check the all properties.
See https://github.com/codeigniter4/CodeIgni...1441049732 |
Welcome Guest, Not a member yet? Register Sign In |