0

I am trying to use the recommended htaccess file to remove the index.php.

but when I clear the Name of your site's index page in admin prefs the css will not load but everything else will on the templates.

my css: <link href="{stylesheet=global_embeds/site_css}" type="text/css" rel="stylesheet" media="screen" />

viewing source it appears fine: <link href="http://domain.com/?css=global_embeds/site_css.v.1379946470" type="text/css" rel="stylesheet" media="screen" />

<IfModule mod_rewrite.c>
        RewriteEngine On

        # Removes index.php from ExpressionEngine URLs
        RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

CSS is a css template in EE

  • Please provide your .htaccess instead of referring to "recommended". Also confirm your CSS file - is it a template or physical file on the server? – Peter Lewis Sep 23 '13 at 15:54
2

Try this in your .htaccess:

RewriteCond %{QUERY_STRING} ^(css=.*)$ [NC]
RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
RewriteRule ^(.*)$ /index.php?/%1 [L]

Before your main index rewrite.

Also if it's a physical file, ensure you have this in your htaccess:

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

Before the index rewrite rule.

So your htaccess may look something like this:

RewriteCond %{QUERY_STRING} ^(css=.*)$ [NC]
RewriteRule ^(.*)$ /index.php?/%1 [L]
RewriteCond $1 !^(images|admin|themes|robots\.txt|index\.php) [NC]
RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

I'm guessing your CSS is a template in "global_embeds" template group...? If so, keep it simple and change your html code as follows:

<link href="/global_embeds/site_css" type="text/css" rel="stylesheet" media="screen" />
| improve this answer | |
  • thanks all I had to do is change: <link href="/global_embeds/site_css" type="text/css" rel="stylesheet" media="screen" /> which is weird because the original method has word previously – Peter Eastwood Sep 23 '13 at 16:07

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.