CodeIgniter Forums
base_url() and site_url() in CI_3.0.3 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: base_url() and site_url() in CI_3.0.3 (/showthread.php?tid=63454)



base_url() and site_url() in CI_3.0.3 - seasenx6 - 10-31-2015

Hello, I using site_url method for load css and js file in my app.

[Image: psuloan.png]

and today I up to CI_3.0.3, site_url is not working I can not load css and js file.

now I must set my domain in $config['base_url'] (not empty) and then site_url is working.

my question in CI_3.0.3 is : why site_url is not working and why I must set my domain in $config['base_url'] ?
(in CI_3.0.2 site_url method is working when $config['base_url'] is empty)

sorry, my eng is bad. thank you.


RE: base_url() and site_url() in CI_3.0.3 - kenjis - 10-31-2015

See Change log: http://www.codeigniter.com/user_guide/changelog.html

> Changed Config Library method base_url() to fallback to $_SERVER['SERVER_ADDR'] when $config['base_url'] is empty in order to avoid Host header injections.

The reason is to avoid Host header injections.


RE: base_url() and site_url() in CI_3.0.3 - seasenx6 - 10-31-2015

Thank you kenjis.


RE: base_url() and site_url() in CI_3.0.3 - kenjis - 11-01-2015

You're welcome.

I found that User Guide has clear explanation how to do.
http://www.codeigniter.com/user_guide/installation/upgrade_303.html#step-2-make-sure-your-base-url-config-value-is-not-empty