Question: what is the difference between base url and site url?
Answer: 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 .