0

i was using wamp for many years without updating it (and without using virtual hosts) and now i installed it on a new computer and the new version forces me to use virtual hosts.

In the older version of wamp, i could link my jquery file to my project in index.php like this :

<script type='text/javascript' src='../jQuery/jquery-1.7.1.min.js'></script>

where index.php is in the directory Bobail (www contains Bobail and jQuery)

In the new version of wamp i have to create a virtual host for my project Bobail and now i can't use the jquery file. If i copy it inside of the directory of my project i can use it without problem but i don't like to have multiple copies of the same code.

Is there a way to use a file outside of the base directory of my project?

  • 1
    You cannot access anything that is outside the document root of your virtual host using path traversal like `../`. What you can do is create a new virtualhost just for static assets (eg `src="http://static.localhost.dev/jQuery/jquery.min.js"`) or you can [create an alias for files that are located outside the document root](https://httpd.apache.org/docs/2.4/urlmapping.html#outside). You could also just use a [CDN link](https://cdnjs.com/libraries/jquery) – Phil Jul 21 '20 at 02:55
  • The whole point of virtual hosts is being able to host two or more sites. But using virtual hosts doesn't make any difference when you only host one site. The error must be somewhere else. – Álvaro González Jul 21 '20 at 15:09

0 Answers0