Closed muh-ramadhan closed 3 years ago
Read the User Guide on Routing: https://codeigniter.com/user_guide/incoming/routing.html
If you need more assistance, support questions need to be directed to the CodeIgniter Forums. GitHub is for bug reports and discussed feature requests.
thanks sir, I mean can I add dynamic url function. in public $ baseURL
and add a few lines in the Constants.php file
whether these changes are allowed, if I change the line public $baseURL = 'http://localhost:8080/';
become public $baseURL = 'DYNAMIC_BASE_URL';
then add the line DYNAMIC_BASE_URL
to app\Config\Constans.php
curl -H "HOST: Ass On Fire" http://target Have fun.
To make the base URL dynamic in the main framework is to introduce a security risk, since as @iRedds pointed out it can be set as anything by the end user. That's why it's done the way it's done currently. Obviously, you're free to make your own decisions on your application and the situation it will be used, but unless for a very specific reason I wouldn't suggest it just to make your life simpler. If you do need that, make sure you have whitelist in place to check them against. Besides - using the .env
file to set your baseUrl is pretty similar to what you're asking for.
thank you sir, what you have conveyed is input for me.
@muh-ramadhan Were you able to use dynamic baseURLs ?
Can I add dynamic url to minimize configuration.