drgdn82648 2013-11-01 13:31
浏览 164
已采纳

加载字体文件CodeIgniter时出错403错误

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.

  • 写回答

3条回答 默认 最新

  • dtlc84438 2013-11-01 13:56
    关注

    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/)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?