poperob
poperob

Reputation: 543

Apache Rewrite Exclusion on CSS File

A charity asked me to help them out with their new site which is a PHP site using Expression Engine for the blog.

They requested i get rid of the .php extensions and rewrite the expression engine path to the blog from /index.php/blog to /blog. I have done this via the rewrites below but a CSS file for the blog is not being displayed and must be caught up in the rewrite.

How can i exclude?

mysite.org/?css=Home/site_styles.v.1335444432

From the rewrite?

Many thanks.

DirectoryIndex home.php
Options Indexes Includes FollowSymLinks
RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET\s.+\.php [NC]
RewriteRule ^(.+)\.php$ /$1 [NE,R=301,L,NC]
RewriteCond %{REQUEST_URI} !\.php$ [NC]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)/?$ /$1.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]  

Upvotes: 0

Views: 718

Answers (2)

Laurence
Laurence

Reputation: 60058

You might want to also check that you are calling the CSS with an absolute path, and not a relative one, because you might have just broken a relative linking with the rewrites?

Upvotes: 0

Jakub
Jakub

Reputation: 20475

Put this before all the other rules

RewriteRule ^(site_styles)($|/) - [L]

if you want multiple things to exclude:

RewriteRule ^(site_styles|js|css|images)($|/) - [L]

Upvotes: 1

Related Questions