I have an htaccess file in the root that redirects every request of a page to a specific file:
RewriteCond %{REQUEST_URI} !^/loader.php(.*)?$ [NC]
RewriteRule ^(.*)$ /loader.php?url=$1 [QSA,L]
Now the redirect is easy in the loader.php
include($_SERVER['DOCUMENT_ROOT'] . '/' . $_GET['url']);
I just include the URL,admin/index.php
for example.
If I leave the code as is the loader will include the file and print the correct HTML, but it will not load any CSS or JS scripts. If I put echo "test";
just before the include, the loader will load the CSS file. It's something that is killing me. Do I have to specify something in the HTTP header?
I already tried putting <base url="" />
in the header of index.php
with no result,
but another strange thing is that with Chrom if I inspect the page and click on the link I'll see the right CSS.
Update 1
I printed the headers_list();
. I noticed one thing - when I print an echo
in headers_list
, an array shows the content-type, so I tried to add it on my own with the header()
function but with no result. Still working on it.
Update 2
I've noticed another thing; if I put a <style></style>
tag with some CSS it will work fine, but if I use the <link />
tag it doesn't. This doesn't make any sense.