Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5936895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:27:46+00:00 2026-05-22T15:27:46+00:00

TLDR: I’m looking for a way to serve web resources (css, jpg, etc) from

  • 0

TLDR: I’m looking for a way to serve web resources (css, jpg, etc) from the filesystem that preserves mime-type.

I am creating a php wrapper that validates a user from another domain (via a one time token), creates a session and then serves files, several websites in separate directories, inside of a otherwise in accesable directory to that user.

I have, so far, used php to handle validation and mod_rewrite to redirect all requests for anything inside of the directory through the wrapper adding the requested page as a get.

The problem is, when I open a webpage that links to other resources it runs through the wrapper for each resource and doesn’t preserve the mime-type. As a result formating gets screwed up.

Does anyone have a work around or a better way to serve files from the filesystem via a php script.

Here are my Redirect rules:

<Directory /var/www/ssl/auth>
    RewriteEngine On
    RewriteBase /auth
    RewriteRule ^(.*) /wrapper.php?topage=https://%{SERVER_NAME}/auth/$1
</Directory>

And This is the include: (after it’s been checked that the file exists)

$path = 'https://'.$_SERVER['SERVER_NAME'].'/';
$abs_path=substr($_GET['topage'], strlen($path));
include ($abs_path);

Here are the errors I’m getting (using dev tools on chrome)

Resource interpreted as Stylesheet but transfered with MIME type text/html

I am creating this so apple users at my school can publish class websites (using iweb and hosted internally) that require authentication and can be accessed without signing in twice when linked from the school’s main website (externally hosted).

The suits are adamant that they want it setup to cross domains.
If you have any suggestions to this particular problem or how to achieve auth. across domains let me know.

Solution

Tandu. Thanks for the help using the concepts you laid out I was able to use stack overflow to solve my problem here is the solution. I < and found how to get the mime type and then I relayed it using header() works like a charm.

$path = $proto.$_SERVER['SERVER_NAME'].'/';
$abs_path=substr($_GET['topage'], strlen($path));
$type = (get_object_vars(apache_lookup_uri("$abs_path")));
header('Content-type: '.$type['content_type']);     
readfile($abs_path);

Hope this helps someone down the line.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:27:46+00:00Added an answer on May 22, 2026 at 3:27 pm

    Well, I’m not sure if I can answer your full question, but the problem in Chrome is that your server is sending the file as the wrong MIME type (obviously). You need to update your server settings to send the correct mime type for css, js, etc. files. It is difficult to guess the mime type for css, js, etc. because they don’t have the mime information stored in the file headers and instead you must guess. You can configure apache to set the mime type based on the extension with the mime.types.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

TLDR: How do I call standard floating point code in a way that compiles
TLDR I have a function that runs on the end of a pan in
TLDR : Tell IE6/7 users to leave in a nice way :) whilst blocking
I have a web form where users submit resume info. Invariably, they copypaste from
TLDR Version: I need to find a way to implement some sort of MessageCenter
tldr; at bottom. Ok, so once again an interesting problem and I'm looking for
TLDR: Does there exist reusable code for automatically reconnecting to a TCP server that
TLDR version: For caching many small database tables that rarely change in my .NET4
Update: This may be something that just isn't doable. See this TLDR: How do
TLDR version: Most important issue is, that in a TSP problem, instead of finding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.