Welcome Guest, Not a member yet? Register   Sign In
setting the base_url()
#1

(This post was last modified: 08-30-2021, 10:41 PM by richb201.)

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?
proof that an old dog can learn new tricks
Reply
#2

(This post was last modified: 08-31-2021, 06:07 AM by captain-sensible. Edit Reason: added text )

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/';
Reply
#3

The issue is that the way I had it worked fine, until i moved to the new server.
proof that an old dog can learn new tricks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB