views:

88

answers:

2

Hi. I have the following mod_rewrite rule:

RewriteRule ^home/ home.php [L]

Fairly simple. When I head to home.php, everything loads fine, but when I head to me.com/home/, the CSS doesn't load. CSS draws from

lib/css/home.css

which isn't in the same folder.. To clarify, my structure is:

/htdocs
home.php
/lib
    /css
        home.css

How can I solve this problem without rewriting my css's references?

+1  A: 

Yeah, that's why I have variable (let's say $sys_url), which holds URL to site (http://www.me.com/). When I want to load CSS, I type

<link rel="stylesheet" type="text/css" href="<?php echo $sys_url; ?>lib/css/home.css" />

Maybe this is nasty and better workaround exists, but it works for me :)

usoban
+1  A: 

i don't know if that will help to solve your problem, but i solved it using base href html tag, smth like

< base href="http://www.domain.com" >

in head section makes all images, css and js files paths relative to www.domain.com

Pavel K.
Note that changing the base URI will affect *every* relative URI and not just relative URI paths.
Gumbo