Mod_rewrite – CSS, JS and Images not working

it’s my first time I am asking a Question here.
I have a problem with mod_rewrite.

I have the following filesystem structure:

site_new/stylesheets/layout.css  
site_new/javascript/somescript.js  
site_new/hallendetails.php  
site_new/etc...

Now I tried to redirect my php Page to an html file via mod_rewrite.
It works fine, my .htaccess looks like that:

RewriteEngine on  
RewriteBase /site_new/  
RewriteRule ^(.*)/(.*).html$ hallendetails.php?id=$1&halle=$2 [L]  

The orignial url is:

localhost/site_new/hallendetails.php?id=01&halle=Heimspielhalle_Gaissacher_Strasse

The “new” url then is:

localhost/site_new/01/Heimspielhalle_Gaissacher_Strasse.html

Now all my CSS, JS and Image files are broken.
They are included like that:
type="text/css" href="stylesheets/layout.css"

But after redirecting they are searched in

/site_new/01/stylesheets/layout.css

I think I need a RewriteCond, but I don’t know how to write it. I tried lots of ways, but I don’t get it.

Please help!


Source: css

Leave a Reply