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.

stylesheet problems when removing index.php from General Configuration

November 06, 2008 8:57pm

Subscribe [4]
  • #1 / Nov 06, 2008 8:57pm

    Jolle

    38 posts

    I’m building my first EE site, for a client, and taking it step by step, but now it seems I’ve found a problem I can’t seem to fix.

    Having removed the index.php from the URLs using the LG .htaccess Generator extension, everything seemed to work fine. That is, until I tried working with title_permalink, which still forced index.php upon URLs. I found the answer for that here on the forums and removed the index.php reference in the General Configuration of System Settings, but now my style sheets are breaking down, apparently they can’t be found anymore.

    In the template:

    <link rel="stylesheet" type="text/css" media="screen" href="{stylesheet=library/css_base}">

    Rendered source with index.php in the General Configuration settings:

    <link rel="stylesheet" type="text/css" media="screen" href="http://www.site.com/index.php?css=library/css_base.v.1225980253">

    After removing it:

    <link rel="stylesheet" type="text/css" media="screen" href="http://www.site.com/?css=library/css_base.v.1225980253">

    That seems perfectly reasonable, it literally removes index.php from that string, but it shows my pages without any css. My guess would be that the question mark is causing problems, but I have “Forcing URL query strings” set to ‘off’.

    Anyone know what to do here?

  • #2 / Nov 07, 2008 11:15pm

    Jolle

    38 posts

    So… no one? :(

  • #3 / Nov 08, 2008 12:16am

    grrramps

    2219 posts

    Why not just hard code the CSS template’s URL?

    <link rel="stylesheet" type="text/css" media="screen" href="http://www.site.com/template_group/css_base">

    I used to take a lot of flack from “best practices” folks who don’t like anything hard coded vs. relative, but Search and Replace is sure a lot easier.

  • #4 / Nov 08, 2008 6:55am

    Jolle

    38 posts

    I can’t believe I hadn’t figured that one out myself (though I might have bounced at adding .css and given up frustrated), a wonderfully simpel solution. Thanks so much, I’ve searched and tried just about everywhere and everything, this issue bothered me to no end!
    And much agreed on the pragmatic/efficient approach vs. the ‘best practices’.

  • #5 / Nov 08, 2008 2:10pm

    grrramps

    2219 posts

    My pleasure. Sometimes the CDO in us has such a strong pull to get everything right according to some predetermined list. As an example, the EE forums are full of posts where people are having trouble removing “index.php” from the URL string and getting things to work. Yes, it can be done, but not on every server on every host can handle it and moving a site from a host that allows a ‘rewrite’ of index.php to one that does not is a recipe for disaster. Removing it is purely a CDO issue.

    CDO?

    Obsessive compulsive disorder. Alphabetized, as it should be.

    😊

  • #6 / Nov 09, 2008 5:38pm

    Jolle

    38 posts

    CDO?

    Obsessive compulsive disorder. Alphabetized, as it should be.

    😊

    :lol:

    Well, other than that both the designer (‘pixel perfect’) and developer (“code = art”) side of me tend to get rid of thing that are redundant, this was a site for a client, they tend to nag about issues such as the index.php.
    It’s hardly the worst thing in the world, but I am quite happy I’ve now been able to strip index.php from the URLs!

  • #7 / Nov 09, 2008 5:48pm

    grrramps

    2219 posts

    Well, other than that both the designer (‘pixel perfect’) and developer (“code = art”) side of me tend to get rid of thing that are redundant…

    I hear you. I still struggle with my inability to organize EE’s templates into any meaningful, efficient, and flexible manner. Alphabetical? Groups?  It’s very frustrating.

    😉

  • #8 / Dec 01, 2008 12:50pm

    Ben Parizek

    128 posts

    This same situation is happening to me.  After I installed the LG .htaccess Generator extension, I got an ?“Internal Server Error.”  I finally figured out that if I commented out the “IndexIgnore *”  I don’t get this error, but then it messed up my stylesheets.

    It has to do with the {stylesheet=template_group/template} tag MIME type.  It says it cannot process the stylesheet on the page because the stylesheet is processed as text/html, instead of text/css.  If I change the tag to {path=template_group/template} or hard code it it works fine as well, though not sure if I have tweaked anything that will result in disaster in the future…

  • #9 / Jan 09, 2009 4:53am

    Chad Crowell

    242 posts

    Found the problem using LG HTaccess:

    For the section of the code that removes index.php you have to remove the | before “members” on the next to last line.  I actually looked at my htaccess after using this to regenerate the file and saw || in the list of template groups and pages.  From some previous experiences I knew immediately this was the issue.  So change this:

    # Remove index.php
    # Uses the "include method"
    # <a href="http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method">http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method</a>
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} ^/({ee:template_groups}|{ee:pages}|members|P[0-9]{2,8}) [NC]
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    To this:

    RewriteCond %{REQUEST_URI} ^/({ee:template_groups}|{ee:pages}members|P[0-9]{2,8}) [NC]

    And your problem might go away.

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

ExpressionEngine News!

#eecms, #events, #releases