我正在尝试建立一个像这样的目录结构的小网站:
rootURL/
landing/
aboutME/
common/
app1name/
app2name/
etc...
在每个子文件夹中都有目录css /,js /和html /所以我将我的页面和应用分开,我的文件类型在它们之间分开,这对我来说似乎是明智的。
我希望在有人访问rootURL.com时加载我的根页
rootURL/landing/html/landing.htm
1)这是否通常可以在Web服务器上配置?
2)是否可以引用不同目录中的css和脚本文件的路径?例如我的lanidng页面rootURL / landing / html / landing.htm,它可以使用行吗
<script type="text/javascript" src="rootURL/common/jQuery.js"></script>
如果没有,还有其他方法可以访问其他目录中的文件吗?
由于
答案 0 :(得分:2)
所有这一切都是可能的。对于您的目标网页,要么必须在根目录中有重定向页面,要么使用URL重写,或者只是将您的主页放在根目录中。
引用您可以使用的路径
<script type="text/javascript" src="/path/to/file.js">
或
<script type="text/javascript" src="../relative/path/to/file.js">
或
<script type="text/javascript" src="http://rootURL.com/path/to/file.js">