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.

RewriteRule ^(.*)$ /index.php?/$1 [L] causes css to fail to load

May 19, 2010 9:04pm

Subscribe [2]
  • #1 / May 19, 2010 9:04pm

    gogglez

    23 posts

    I was going about building the site I’m working on when suddenly the css stopped loading. I thought it was weird so I poked around and found no problems with anything I’d done. Finally I looked at the .htaccess file and started removing rules, and by chance, removing ‘RewriteRule ^(.*)$ /index.php?/$1 [L]’ happened to allow the site to load the css again, but of course the navigation was broken and regardless of where I navigated to, it loaded the home page.

    I’m not sure where to go from here - Is there something I could have done to cause an automatic rewrite of my .htaccess file?

    [Mod Edit: Moved to the How to forum]

  • #2 / May 20, 2010 2:24am

    Wouter Vervloet

    758 posts

    Hi,

    If you add the following to your .htaccess file (above the RewriteRule) does it fix your problem with the CSS?

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    What this does is: If the there is a request for a physical file or folder the URI doesn’t get rewritten. Pretty straightforward.

    Greetz,
    Wouter

  • #3 / May 21, 2010 12:16am

    gogglez

    23 posts

    It doesn’t appear to make a difference unfortunately.

    I’ve done some reading on .htaccess files since this post and I’m still kind of lost. I just don’t fully understand what my file is doing… And I imagine that sounds weird, but it was generated by LG .htaccess generator.

    Here is the file:

    Action php5-script /gs-bin/php-5.2.6-1
    AddHandler php5-script .php
    
    # -- LG .htaccess Generator Start --
    
    # .htaccess generated by LG .htaccess Generator v1.0.0
    # <a href="http://leevigraham.com/cms-customisation/expressionengine/addon/lg-htaccess-generator/">http://leevigraham.com/cms-customisation/expressionengine/addon/lg-htaccess-generator/</a>
    
    # secure .htaccess file
    <Files .htaccess>
     order allow,deny
     deny from all
    </Files>
    
    # Dont list files in index pages
    IndexIgnore *
    
    # EE 404 page for missing pages
    ErrorDocument 404 /index.php?/
    
    # Simple 404 for missing files
    <FilesMatch "(\.jpe?g|gif|png|bmp)$">
      ErrorDocument 404 "File Not Found"
    </FilesMatch>
    
    RewriteEngine On
    
    RewriteBase /
    
    # remove the www
    RewriteCond %{HTTP_HOST} ^(www\.$) [NC]
    RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    # Add a trailing slash to paths without an extension
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    # 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} ^/(site|listings|traffic|forum|announcements||food_entertainment|_new_faces_in_the_san_francisco_office|comms_events|leadership|green|traffic|announcements_form|members|P[0-9]{2,8}) [NC]
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    # Remove IE image toolbar
    <FilesMatch "\.(html|htm|php)$">
      Header set imagetoolbar "no"
    </FilesMatch>
    
    # -- LG .htaccess Generator End --

    Does anything appear wrong with that?

  • #4 / May 21, 2010 12:18am

    gogglez

    23 posts

    Worst of all right now is that I can’t access my control panel and I’m not having any luck through editing the file.

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

ExpressionEngine News!

#eecms, #events, #releases