Hello I am new to codeigniter. I am using the external font file for my site through css. Here is my css code:
@font-face {
font-family: 'ElegantIcons';
src:url('http://localhost/findacare/font/ElegantIcons.eot'),
url('http://localhost/findacare/font/ElegantIcons.eot?#iefix') format('embedded-opentype'),
url('http://localhost/findacare/font/ElegantIcons.woff') format('woff'),
url('http://localhost/findacare/font/ElegantIcons.svg#ElegantIcons') format('svg'),
url('http://localhost/findacare/font/ElegantIcons.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
But i'm getting the following error file when i load the file
GET http://localhost/findacare/font/ElegantIcons.woff 404 (Not Found) manage_profile:1
GET http://localhost/findacare/font/ElegantIcons.svg 404 (Not Found) /findacare/font/ElegantIcons.svg#ElegantIcons:1
GET http://localhost/findacare/font/ElegantIcons.ttf 404 (Not Found) /findacare/font/ElegantIcons.ttf:1
And my file structure is:
findacare-
-application
-css
-font
-images
I checked many times even by giving absolute path. Could any one please help me.
If you look in your .htaccess
file you most likely have a line of code that looks something like this:
RewriteCond $1 !^(index\.php|robots\.txt|css/|js/|images/)
This is a white list of folders/files that won't be passed through your applications index.php. All other urls will be passed into the application.
Because your font folder is in the webroot, you need to add this folder to the whitelist so that it can be accessed by your css rules.
RewriteCond $1 !^(index\.php|robots\.txt|css/|js/|images/|font/)
as mentioned by you in your file structure folder name is "fonts" and in your css source path you are using "font".
I have used it like this in one of my project, if you have these lines in a css
file inside the css
folder then try this may help:
@font-face {
font-family: 'ElegantIcons';
src:url('../font/ElegantIcons.eot'),
url('../font/ElegantIcons.eot?#iefix') format('embedded-opentype'),
url('../font/ElegantIcons.woff') format('woff'),
url('../font/ElegantIcons.svg#ElegantIcons') format('svg'),
url('../font/ElegantIcons.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}