0

I'm just wondering if it is possible to use css/js files from outside the webroot on a Windows 7 machine. If I try to right now, Chrome console says not allowed to load local resource. Is there a way to go around this?

If I have the following file structure:

C:
    xampp
        htdocs (webroot)
            myproject
                index.php
    otherFolder
        css
            style.css
        js
            main.js

Is there a way to get index.php to use style.css and main.js?

Rickkwa
  • 2,197
  • 4
  • 23
  • 34
  • I would just add the otherFolder location to a new virtual host. Web servers don't give you access to the file system, and in a production environment there would be no way to make this happen. Essentially, you want to cross-link the CSS/JS files from another host, which is entirely possible. – aaronburrows May 20 '13 at 15:45
  • What about using symbolic links? http://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/ – seemly May 20 '13 at 16:26
  • @seemly It seems possible with symbolic links, thanks. – Rickkwa May 20 '13 at 18:09
  • @aaronburrows Can you elaborate on what you mean by production environment? This site isn't going public; its just for our building, thus the site is hosted on this server running xampp. – Rickkwa May 20 '13 at 18:15
  • I mean that if you publish the site "publicly", even for internal users, you won't be able to access the file system directly. Every file served needs to come from a web server (hostname). So I would either move the file into the webroot or create a second virtual host in order to access those files. – aaronburrows May 22 '13 at 14:18

0 Answers0