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 4547808
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:08:32+00:00 2026-05-21T16:08:32+00:00

I’ve got a framework that routes all incoming URIs through a base file, and

  • 0

I’ve got a framework that routes all incoming URIs through a base file, and to deal with static files I’ve got a sub-directory /static in which I put all CSS, JS and images (ie. /static/css/main.css) in order to keep things clear.

My own code and plugins deal with this fine, but some times other code needs to be implemented, and often CSS files will try to style up with calls to URIs in those files. How can I deal with this in the best way?

An example ;

/about/company
routes to
/script?q=about/company
and locks in the main structure of the site. However;
/static/css/main.css
uses a background image from;
/static/images/widget/bg-color.png

Since this is a framework I’m not happy to hard-code the /static paths in the CSS files. For one, I don’t want to restrict websites to only being served from some root directory. 🙂 For all JS there’s objects that deal with this (ie. var x = $xs_dir.js + ‘/script.js’ 😉 but nothing exists for CSS. I have five options, I think ;

  1. (worst) Have an option in my admin tool that scans all CSS files for URI references, and prepends them with the right static directory, and writing all CSS as if they’re static to a root directory.

  2. (poor) Rely on the webserver’s ability to alias any static directory to one root static directory, and let the admins deal with it.

  3. (meh, slow) Serve the CSS files through the framework, filtering URIs with the right static paths.

  4. (simplest, but not very easy) Hand-code the static portions of my CSS files for whatever server setup there might be, and just make sure they’re easy to find and change.

  5. (probably best, but complex?) Have a rewrite rule that detects images in current directory, forwarding them to the static directory, and write all CSS with some recognized dynamic path. (ie. instead of /static/images/img.png do images/img.png and rely on rewrite rules to push it where it needs to go, also restricting the website structure to never have a sub-directory called ‘images’)

Any additional options? Ideas? I know Joomla and similar has some rewriting of files, and probably do no. 5?

  • 1 1 Answer
  • 0 Views
  • 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-21T16:08:32+00:00Added an answer on May 21, 2026 at 4:08 pm

    Not sure whether you have an .htaccess file or not, but one option would be to put in a rewrite rule for request under a folder “images” to be redirected to your static (or whatever) folder:

    RewriteRule ^[^\?]*(images/)(.*)$ /static/$1$2 [NC,L]
    

    That way you can reference all your images as just /images/whatever.png in your CSS.

    If you require a different setup for different servers, you could always have a separate .htaccess file for each environment or server, and version control these.

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

Sidebar

Related Questions

We are using XSLT to translate a RIXML file to XML. Our RIXML contains
i want to parse a xhtml file and display in UITableView. what is the
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I need to clean up various Word 'smart' characters in user input, including but

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.