url rewriting - URL rewrite issue not loading .css -


i'm porting an old site new template , having problems windows 2008 rewrite module. link i'm trying rewrite looks this:

http://ltweb2008.serveronline.net/product.php?pid=75

and brings page fine. apply new url , loads proper content, doesn't load template's style.css file anymore.

http://ltweb2008.serveronline.net/product/75/any-text-here

the problem seems company made template (canvas) put main .css file in root directory, loaded rest in /css. can't main .css file load using rewrite , when move down /css displays blank page, though when check out page source it's there.

with page shows not using style.css (with rewrite):

<link rel="stylesheet" href="style.css" type="text/css" />

with of these page blank (with rewrite):

  1. <link rel="stylesheet" href="/style.css" type="text/css" /> or
  2. <link rel="stylesheet" href="/css/style.css" type="text/css" /> or
  3. <link rel="stylesheet" href="http://ltweb2008.serveronline.net/style.css" type="text/css" />

i'm using pattern:

^product/([0-9]+)/([^/]+)$

and rewrite url:

/product.php?pid={r:1}

does know i'm missing?

one solution use absolute path (ex /css, or /js rather css/, /js not looks reliable solution since we've change on files,

this because relative uris have base changed. originally, base / when page /product.php?id=75, , browser fills in relative links / base. when browser goes page /product/75/any-text-here base becomes /product/ , tries append in front of relative urls , none of them load.

you can either make links absolute, or change uri base in header of pages (inbetween <head> </head> tags):

<base href="/"> 

Comments