Missing images after I redirect to a subdirectory using route.php and/or .htaccess in CodeIgniter Framework

367 views Asked by At

I redirected

views/hello.php

to this url path, without creating a subdir:

www.domain.com/subdir/hello

by using route.php

$route['subdir/hello'] = 'pages/view/hello';

however, some of the pictures that's inside hello.php were gone. I checked the "images" folder but it's still there.

I did check Inspect Element and there was an error:

Resource interpreted as Image but transferred with MIME type text/html

I've researched with this error but I didn't get any resolution. Without the redirection the images are still there. Please help.

Adding Edit:

This is also shown in the inspect element console error

GET http://p.nexac.com/e/sr/a-1548/s-3271/s-3271.xgi net::ERR_BLOCKED_BY_CLIENT
getSegment.php?purl=http%3A%2F%2Fwwf.org.ph%2Fclimate-solutions&jsref=&rnd=1433844490975:1 
GET http://adadvisor.net/adscores/r.pixel?sid=9212270798 net::ERR_BLOCKED_BY_CLIENT
getSegment.php?purl=http%3A%2F%2Fwwf.org.ph%2Fclimate-solutions&jsref=&rnd=1433844490975:1 
1

There are 1 answers

1
Rejoanul Alam On BEST ANSWER

htacces or routing doesn't matter here. Your path is wrong. Use this, it will work everywhere

<img src="<?php echo base_url('images/wwd_climate-solutions.jpg');?>" alt="Climate Solutions">

assuming that you do not make any change to config.php file's parameter $config['base_url']