1

I cannot get style sheets, template type CSS, to display. All I get is a 404 error when I attempt to view a CSS file, js works fine.

http://mydomain.com/?css=style/mycss

Displays a 404 error

Running under Apache2, error log appears to be no help. I was thinking this looks like a permission error, but no seeing that js works.

ExpressionEngine v2.9.0 - Build Date: 20140715

Has anyone seen this before?

  • is there a reason to run your CSS through ExpressionEngine? – Steven Grant Sep 4 '14 at 21:33
1

Your url adress is not correct, to display your css file, you have to set the related path:

Mydomain/path/file.css

An example: Domain.com/main/color.css

No need to put ?css=, it will give you a 404 error.

But why do you want to display a css file?

If you use a css template you have to insert the template path inside the page header.

href="{stylesheet='channel/channel_css'}"

| improve this answer | |
  • It is working?? try to have a look here: ellislab.com/expressionengine/user-guide/templates/globals/… – Stéphane Sep 4 '14 at 5:54
  • Hello Stéphane, 1) the URL is directly from EE, Templates > Template Groups > Style (my template group name) > View. 2) mydomain.com/style/mycss gives me the same results, as does href="{stylesheet='channel/channel_css'}" 3) Agreed about using EE for CSS, but sometimes I want to do quick testing and templates come in handy. 5) I will check out the link next. Thanks. – Jonathan Sep 4 '14 at 13:00
  • <link rel="stylesheet" type="text/css" media="all" href="{stylesheet='channel/channel_css'}" /> Gives 404. I'm going to do a clean install as I have no idea what is going on here. – Jonathan Sep 4 '14 at 13:33
0

Now i understand your css path. It's html code created by EE. So i've created a template too inside the html header:

No problems related, when i show the code source it appears:

http://domain.com/?css=essai/essai_css

So your problem could be a SERVER PATH TO SITE'S TEMPLATES, that you can set in template/global preferences. Or perhaps a redirect problem isnside .htaccess. Check the template path too.

| improve this answer | |
  • Thanks for all your help Stéphane. I checked the server path in EE and it is fine. I cleared out my .htaccess file, even added index.php back into EE, all with no luck. Again this is only css files, strange. I'm thinking this might be a cache issue. SO I went as far as rebooting the machine allowing only my local IP in through the firewall, to avoid outside influence. And bingo, if I only hit the css file it appears. If I then go to another non-css page and then try another css file noting. – Jonathan Sep 5 '14 at 2:47
  • it's very weird.... I hope you problem will be resolved soon. Good luck !! – Stéphane Sep 5 '14 at 13:02
0

I ran into the same issue with v2.9.2. The only thing that worked for me was to

  • hard code the full path to the css files into the head template,
    href="/system/expressionengine/templates/default_site/stylesheets/base-css" instead of href="{stylesheet='stylesheets/base-css'}"
  • enable "Save Template as File" in the stylesheet template group.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.