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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:39:46+00:00 2026-06-04T16:39:46+00:00

Say I have the following structure for 3 different apps that live on 3

  • 0

Say I have the following structure for 3 different apps that live on 3 different domains, and a personal “cdn” where I can put files that are common across all three apps:

root/
     /dinosaureggs.com
     /magicalapples.com
     /wizardsupplies.com
     /mypersonalcdn.com
          /js
          /php
          /css

This same structure is mirrored on a local and production environment.

If I’m in dinosaureggs.com and I want to use a shared PHP library in the /php folder I can say:

require('/../mypersonalcdn.com/php/library.php')

This works fine on both the local and production servers.

However, it won’t work for JS because JS includes can’t back out of the “app” with paths the same way PHP can.

I can’t say:

<script type="text/javascript" src="/../mypersonal.cdn/js/library.js"></script>

Now, on live I could say:

<script type="text/javascript" src="http://mypersonalcdn.com/js/menus.js"></script>

But this doesn’t solve my problem for local environment (at least to the extent that I wish to leave it truly locally and have the option to develop offline).

Any suggestions?

  • 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-06-04T16:39:47+00:00Added an answer on June 4, 2026 at 4:39 pm

    While the PHP to fetch JS method above was ok, this was a much more straightforward solution that I eventually landed on:

    Serving files outside of doc root / having common client files across multiple domains

    To do this you set a mod_alias in http.conf

    On local environment that looked like this:

    Alias /shared/ "/Users/Jane Doe/Sites/shared"
    <Directory "/Users/Jane Doe/Sites/shared">
        Options Indexes MultiViews
        Order allow,deny
        Allow from all
    </Directory>
    

    This makes it so you can call a css (or image or js or whatever) like this:

    But instead of looking in /shared/ on that domain, it’d go to wherever on the server you had “shared” pointed to; in this case: /Users/Jane Doe/Sites/shared/

    Resources:

    • Serving images from outside of document root
    • http://httpd.apache.org/docs/2.0/mod/mod_alias.html#alias
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have the following MySQL structure: CREATE TABLE `domains` ( `id` INT(10)
Lets say we have the following structure in a web page. How can i
In c, say you have the following structure and an instance of that: #include
Say I have the following structure for a list: <ul> <li></li><li></li> <li></li><li></li> </ul> and
Say I have the following query ICriteria query = session.CreateCriteria(typeof(T)); How can I find
Say I have the following XML <?xml version=1.0 encoding=utf-8?> <Person> <FirstName>Bjorn</FirstName> <LastName>Ellis-Gowland</LastName> </Person> That
Say I have the following structure: <div id=top style=width:960px; height:400px; margin 0 auto; background-color:#F00;>
Say I have the following structure: package require Itcl itcl::class AAA { private variable
Say I have this following XML structure: <?xml version=1.0 encoding=UTF-8?> <main> <parent> <child1>some value</child1>
Let's say we have the following menu structure: menu #1 menu #2 menu #3

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.