简体   繁体   中英

How to access files outside of root directory in localhost?

I have some common angular files one-level outside of my local site's root directory, like so:

-- angular.js
-- angular-sanitize.js
-- root
   |-- index.html
   |-- client.js
   |-- style.css

I want to link the files to index.html , so I tried something like (for angular.js),

  • ../angular.js
  • /G:/User/angular.js
  • ./../angular.js

but none of them worked out. Why it is so and how to do it correctly?

EDIT: I'm using a Python server.

You cannot access files outside your htdocs folder because your server considers that to be the root folder. Hence has no parent folder. Or in basic terms, your apache server is only available in your htdocs folder. So you might have to move your files there or give a link to them online.

Conclusion: There is no way you can do that.

Or maybe you have to edit your httpd.conf file

您必须将整个项目放在服务器文件夹(htpdocs,http等)中,然后在项目内部使用--.. / somescript.js之类的链接来访问文件夹外部的文件,但不能访问服务器空间

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM