0

I have exactly the same problem treated in this topic. That's: I have some static files in some folders and I want only some users to see that content. That users are coming from a previous login.

To get that, I'm trying to implement the first solution given in this topic, that's:

Create the following .htaccess file under "static-files":

Options +FollowSymLinks  
RewriteEngine on  
RewriteRule ^(.*)$ ../authorize.php?file=$1 [NC]

And then in authorize.php...

if (isLoggedInUser()) readfile('static-files/'.$_REQUEST['file']);
else echo 'denied';

This authorize.php file is grossly over simplified, but you get the idea.kquote

So, redirect any request to the authorize.php file, who check if the user is logged in and, if so, serve the content.

That's working perfectly with html, js and images... but I don't know why css styles are not showed. It's strange, because I can access that css files directly with my browser, but when they are called from the html it's not working. Of course, if I try to work without the authorize.php styles are showed as usual.

What am I missing out?

Thank you,

Community
  • 1
  • 1
Waiting for Dev...
  • 12,629
  • 5
  • 47
  • 57

1 Answers1

2

You are probably not sending the right content-type header. That makes style sheets fail in Firefox.

Do a

header("Content-type: text/css");

whenever a CSS style sheet has been requested.

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
  • Thank you @Pekka that was exactly the problem. Solved, now. But not only in Firefox, because I was testing as well with Opera and Chrome. – Waiting for Dev... Sep 26 '11 at 16:28
  • Years ago I have an issue with CSS generated with PHP and Internet Explorer 4 or 5, I don't remember. The browser was crashed when try to open CSS files gziped. – corretge Sep 26 '11 at 16:56