Github pages, bootstrap css remotely: resource failed to load: server responded with 404 status (not found)

I have a customized bootstrap site that I click on github pages. Locally, it works very well, no problem at all, but when it’s online, the style is dirty and these messages appear on the console:

Failed to load resource: the server responded with a status of 404 (Not Found) https://nickname.imtqy.com/repo/vendor/font-awesome/css/font-awesome.min.css Failed to load resource: the server responded with a status of 404 (Not Found) 

in my code, css is declared as follows:

 <link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> 

why does it work locally and not remotely?

+5
source share
3 answers

It looks like you are using Jekyll for your GitHub page. As for Jekyll 3.3 from Nov 2016, the vender folder is ignored .

Jekyll now ignores provider directories and node_modules by default.

You can either rename the vender folder to some name, like libs , and refer to the new path, or follow the Jekyll sentence

If you need these directories included in your site, install exclude: [] in the configuration file of your site.

Hope this helps :)

+2
source

Thanks to everyone. The problem was that Github recently upgraded to Jekyll v3.3, which by default ignores custom-created files. Since I did not use Jekyll for my Pages site, I had to add the .nojekyll file to the root of my repository in order to disconnect Jekyll from creating my site. As soon as I did this, my site built with my files without any problems.

+3
source

If you are sure that the path with css is not empty on your server, you need to use ~/ in HTML href, let me explain

  • / - href="vendor/font-awesome/css/font-awesome.min.css" is the root of the site

  • ~ / - href="~/vendor/font-awesome/css/font-awesome.min.css" is the root directory of your application

/ should return the root of the site ( https://nickname.imtqy.com/repo/vendor/font-awesome/css/font-awesome.min.css )

~/ should return the root of the application ( https://nickname.imtqy.com/ROOTDIR/repo/vendor/font-awesome/css/font-awesome.min.css ).

0
source

Source: https://habr.com/ru/post/1259361/


All Articles