I have the this project:

In the index I check the url with this code:
if( isset( $_GET['url'] ) ) {
if( file_exists( 'classes/layout/'.$_GET['url'].'.php' ) ) {
require_once 'classes/layout/'.$_GET['url'].'.php';
}
}
And in my .htacces this:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^(.*?)$ index.php?url=$1&%{QUERY_STRING} [L]
This works great. When is go to example: 127.0.0.1/test/pages/edit the index includes edit.php but in the index i use a css file named: test.css wich make the whole html background red.
If i go to 127.0.0.1/test/ i see the whole background red. But when i go to 127.0.0.1/test/pages/edit it is white. I checked the urls of the css file and i get this:
127.0.0.1/test/ = 127.0.0.1/test/cache/css/test.css
127.0.0.1/test/pages/edit = 127.0.0.1/test/pages/cache/css/test.css
Does someone know how to fix this?
if($_GET['pageId'] == 'page1') { require_once('path/to/file'); }.