CodeIgniter Forums
setting the base_url() - 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: setting the base_url() (/showthread.php?tid=79997)



setting the base_url() - richb201 - 08-30-2021

I am moving my app from my laptop to my remote server but it seems that the directories are not working. This is an example of an image that is not being found. 

<img src="<?php echo base_url(); ?>assets/themes/default/images/Logo - Research Study Online-01.jpg" style="float:left;margin-top:5px;z-index:5" alt="logo"/>

On localhost I used:
$config['base_url'] = 'http://localhost';
and that worked fine.

but on the remote server I use:
$config['base_url'] = 'http://www.researchstudyonline';

The actual path to the image on the remote server (according to FileZilla) is
sftp://[email protected]/home/ubuntu/rst/RST/app/assets/themes/default/images/rsz_logo_-_research_study_online-01.jpg

What should I set base_url to allow the code to run on the remote server? How do I know what actual dir the www.researchstudyonline URL is pointing at on the remote server?


RE: setting the base_url() - captain-sensible - 08-31-2021

For codeIgniter4

On Desktop using spark serve i set mine (app/config/App.php ) to:

public $baseURL = 'http://localhost:8080/';

ON Apache i set up to use 127.0.0.5

public $baseURL = 'http://127.0.0.5/';

for images ,depends where they are if relative to public directory then;
<img class ="img-fluid" src = "<?php echo base_url('images/logo.png'); ?>" >

// images is a directory inside public
so depends where assets dir is ; there are . See the difference in use between my code and yours. Also
note "/" at end of

public $baseURL = 'http://localhost:8080/';


RE: setting the base_url() - richb201 - 08-31-2021

The issue is that the way I had it worked fine, until i moved to the new server.