Joanna Lancaster
Joanna Lancaster

Reputation: 761

.htaccess rewrite rule breaking css

im still new to .htaccess

so i looked on stackoverflow for my answer and i cant find it. i have rules for my site i had to setup so i got my rules from this:

SEO Friendly URL to Dynamic URL using PHP

RewriteEngine on
RewriteBase /
RewriteCond  %{REQUEST_FILENAME} !-f
RewriteCond  %{REQUEST_FILENAME} !-d
RewriteRule  ^(.*)$ index.php?request=$1 [QSA,L]

but for some reason my css is broken but my php is good

example url:

http://www.domain.com/aboutme
http://www.domain.com/css/version.css

Upvotes: 2

Views: 1242

Answers (2)

luiscabus
luiscabus

Reputation: 309

I have a super answer for this problem. I've been looking everywhere for an easy solution that wouldn't make me hardcode baselinks for all my relative paths, like imgs, css, javascript...

So here it goes, add this between the <head> tags of the pages you are having problems:

<base href='http://www.mydomain.com/'>

This will make that your relative path links will start with this base link. Simple as that.

The <base> tag specifies the base URL/target for all relative URLs in a document. Put the <base> tag as the first element inside the <head> element, so that other elements in the head section uses the information from the <base> element.

Did it work for you?

Upvotes: 1

Shiplu Mokaddim
Shiplu Mokaddim

Reputation: 57650

The problem is due to Capitalized file name Version.css.

If your devbox is windows it'll work. Windows is case insensitive.
But when you test it in server (Unix) it will break.
Because Unix is case sensitive

Better rename Version.css to version.css. Its safe for the future

Upvotes: 5

Related Questions