White Mask Guy White Mask Guy - 6 months ago 46
PHP Question

Php echo base_url failed to load css

I want to load awesome.css in my php file. I have a code like this in my php :

<link rel="stylesheet" type="text/css" href="<?php echo base_url('resources/web2/lib/css/awesome.css'); ?>"/>

But when I check the awesome.css file, there is a code which have link to another url :

@font-face{font-family:'FontAwesome';src:url('../resources/web2/lib/font/FontAwesome/fontawesome-webfontf77b.eot?v=3.2.1');src:url('../font/FontAwesome/fontawesome-webfontd41d.eot?#iefix&v=3.2.1') format('embedded-opentype'),url('../font/FontAwesome/fontawesome-webfontf77b.woff?v=3.2.1') format('woff'),url('../font/FontAwesome/fontawesome-webfontf77b.ttf?v=3.2.1') format('truetype'),url('../font/FontAwesome/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1') format('svg');font-weight:normal;font-style:normal;}

And when I load the page in web browser there is an error like this :

downloadable font: download failed (font-family: "FontAwesome" style:normal weight:normal stretch:normal src index:0): bad URI or cross-site access not allowed source: http://[::1]/yisc/resources/web2/lib/font/FontAwesome/fontawesome-webfontf77b.eot?v=3.2.1`

Please kindly help me to solved this issue, I really don't understand what happens here.


Go to config.php and set the baseurl

$config['base_url'] = 'http://stackoverflow.com/';

Its better to take look at Codeigniter Documentation about Base Url

src:url('../font/ depends on the folders you are being. Check Path (computing) in wiki