Difference betwwen CodeIgniter Site Url and base Url

Viewed 15173

Hello What is the difference between SiteUrl() and BaseUrl() ? In my previous project it is base url but now in my new project it is Siteurl.Why this happens? Is baseurl() is an outdated one

3 Answers

No doubts the answers by kumar_v and nidheesh are absolutely correct . However , I would like to add when to use base_url() and the site_url() . Basically one can use site_url() while creating links for controllers whereas base_url() can be used where we need to create urls for the assets like loading a css or js file or some image .

What I always prefer is to use site_url() for creating links to controllers or ajax urls and base_url() for loading assets .

Related