ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

CSS stylesheet not linking correctly when index.php is removed

September 17, 2011 3:20pm

Subscribe [6]
  • #1 / Sep 17, 2011 3:20pm

    xlawdog

    62 posts

    I have removed ‘index.php’ from my URLs per the instructions in the EE User Guide for EE 2.2.2. Now the stylesheet links do not work correctly.

    In my template, the code for the link, which worked before I removed ‘index.php,’ is:

    <link rel="stylesheet" href="{stylesheet='_css/core_css'}">

    If I view the page source, this link now reads as follows:

    <link rel="stylesheet" href="http://www.SITE-NAME.com/?css=_css/core_css.v.1316275057">

    In other words, EE is inserting

    ?css=

    in the link, and as a result, the stylesheet is not being referenced by the page.

    I can use the path variable instead (I tested it and it works), but I’d prefer to use the stylesheet format so that the stylesheet is lighter (according to the documentation). Am I missing something in the formatting of my stylesheet link?

    Brian

  • #2 / Sep 18, 2011 6:01pm

    Kevin Smith

    4784 posts

    Hi xlawdog,

    If you directly call from a browser the stylesheet link you linked above (http://www.site-name.com/?css=_css/core_css.v.1316275057), does it bring up the stylesheet? That same format stylesheet URL is what my own installation produces when I remove index.php from the URLs, but it works just like I’d expect.

    Could you let me know what host you’re using for this site?

  • #3 / Sep 28, 2011 12:11pm

    Britizen

    36 posts

    @Kevin

    I’m experiencing exactly the same issue with my style sheets. I’m on enginehosting.
    I’m trying to remove the index.php for the first time using the user guide instructions to the letter.

    Did this issue get identified/resolved?

  • #4 / Sep 28, 2011 12:27pm

    Britizen

    36 posts

    Update: the site is working other than the complete absence of any styles.

    One thing I’ve noticed: some of the urls still have the ‘index.php’ in them. Do I have to remove any instances of ‘/index.php’ I am using in my templates? (I don’t use the {path='group/template'} method everywhere).

    Is there more documentation/examples on this that I’m missing?

  • #5 / Sep 28, 2011 7:46pm

    xlawdog

    62 posts

    Kevin,

    I checked per your suggestion and the direct URL was not returning the stylesheet.

    However, after doing some more troubleshooting, I realized that the problem stemmed from the fact that I’ve been hiding the site behind an “index.html” file while it’s in development. Once I removed the index.html file and tried it again, it worked fine.

    So until the site is ready to launch, I’ll keep the path variable, and then when it’s ready to go I’ll switch over to the stylesheet format.

    Thanks for your help.

    Brian

  • #6 / Sep 29, 2011 12:32pm

    Mark Bowen

    12637 posts

    Hi Brian,

    Glad you managed to find out what was going on here.

    If anything else crops up then please don’t hesitate to post again as needed.

    Thanks,

    Mark

  • #7 / Oct 18, 2011 1:32pm

    xlawdog

    62 posts

    I’ve launched my client’s site and removed the index.html file that I thought was causing the problem, but now I am experiencing a somewhat different problem with the Stylesheet Global Variable.

    The file name that it inserts is correct—I can test it as suggested by directly entering the URL in the browser. However, the variable is not generating a link tag for the stylesheet; it’s just generating the absolute path to the stylesheet. So, for example, for a 960 Grid stylesheet, where the template group is “_css” and the stylesheet template name is “960,” instead of:

    <link rel="stylesheet" href="http://[site-name]/_css/960">

    which is produced using the Path variable, with the Stylesheet Global Variable I get:

    http://[site-name]/?css=_css/960.v.1316657294

    When I first encountered trouble with this while the site was in development, I was using EE 2.2.2, but the site has now been updated to EE 2.3.0 Build 20111011.

  • #8 / Oct 18, 2011 3:00pm

    Chris C.

    47 posts

    I’m seeing this very same issue in 2.3.1. I had to switch the style code to href=”{stylesheet='style/base'}”, which isn’t ideal as that code doesn’t seem to play nice with MSM. I’d appreciate any advice to try and get the other link style to work.

  • #9 / Oct 18, 2011 3:51pm

    ahmad saad

    364 posts

    please write the code in .htaccess

    I had the same problem and I solved it but I have to see your code first

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases