Priyanka
Priyanka

Reputation: 127

GET 404 error for style.css not found

I am currently working on codeigniter framework, in the view i added my custom 404 error's page. But it is not loading the stylesheet from the folder errorpage/web/css/style.css. And i am getting an error in the browser's console GET : url/style.css 404(not found) (url is the address of my folder where my css file is)

Upvotes: 8

Views: 78914

Answers (4)

Jan Rijavec
Jan Rijavec

Reputation: 1

In my case problem was in incorrect file premissions (should be 644). In some cases is also smart to consider clearing cache in cloudflare.

Upvotes: 0

Vikram Sapate
Vikram Sapate

Reputation: 1297

Change <base href="/"> to <base href="./"> from index.html

Upvotes: 0

Amaan Iqbal
Amaan Iqbal

Reputation: 761

You can try replacing the contents of original 404 Page Not Found error page with your custom error page. Make sure you doesn't change the name of that file or its location.

Hope it helps

Upvotes: 0

Tom
Tom

Reputation: 2645

404 is a 'not found' error. Meaning, the browser cannot find your style.css with the path it was given. If it is working on some templates and not others, it is because you may have a different file structure for some templates, a sub-folder for example.

A quick fix would be to make your style.css load from an absolute path

https://yourdomain.com/public/css/style.css

A better solution would be to traverse the directory to the css folder and then reference your style.css.

Learn about relative paths and find a solution that works for all templates. The answer is likely to be something like:

/public/css/style.css

However, it could be something like:

../public/css/style.css

Where goes back to one more previous directory. More about absolute vs. relative paths http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/

Upvotes: 5

Related Questions